diff options
| author | Georgios Andreadis <info@gandreadis.com> | 2020-07-06 08:43:42 +0200 |
|---|---|---|
| committer | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2020-08-24 19:47:24 +0200 |
| commit | 7331e9baf2cfe7bdfb24effcf0a4801da1e7ea4d (patch) | |
| tree | 5e999ef6007f89d2e06a26f65b0e37b9ce6e9bc4 /web-server/opendc/api/v2/experiments | |
| parent | e254f4cc4fa6e2446fd4689cc7cabf3abbc24af6 (diff) | |
Make tests consistent
Diffstat (limited to 'web-server/opendc/api/v2/experiments')
| -rw-r--r-- | web-server/opendc/api/v2/experiments/experimentId/endpoint.py | 9 | ||||
| -rw-r--r-- | web-server/opendc/api/v2/experiments/experimentId/test_endpoint.py | 30 |
2 files changed, 16 insertions, 23 deletions
diff --git a/web-server/opendc/api/v2/experiments/experimentId/endpoint.py b/web-server/opendc/api/v2/experiments/experimentId/endpoint.py index 1611f889..dc056454 100644 --- a/web-server/opendc/api/v2/experiments/experimentId/endpoint.py +++ b/web-server/opendc/api/v2/experiments/experimentId/endpoint.py @@ -19,12 +19,9 @@ def GET(request): def PUT(request): """Update this Experiments name.""" - request.check_required_parameters(path={'experimentId': 'string'}, - body={ - 'experiment': { - 'name': 'string', - } - }) + request.check_required_parameters(path={'experimentId': 'string'}, body={'experiment': { + 'name': 'string', + }}) experiment = Experiment.from_id(request.params_path['experimentId']) diff --git a/web-server/opendc/api/v2/experiments/experimentId/test_endpoint.py b/web-server/opendc/api/v2/experiments/experimentId/test_endpoint.py index f3aa111c..3532f9ae 100644 --- a/web-server/opendc/api/v2/experiments/experimentId/test_endpoint.py +++ b/web-server/opendc/api/v2/experiments/experimentId/test_endpoint.py @@ -48,12 +48,11 @@ def test_update_experiment_missing_parameter(client): def test_update_experiment_non_existing(client, mocker): mocker.patch.object(DB, 'fetch_one', return_value=None) - assert '404' in client.put('/api/v2/experiments/1', - json={ - 'experiment': { - 'name': 'test', - } - }).status + assert '404' in client.put('/api/v2/experiments/1', json={ + 'experiment': { + 'name': 'test', + } + }).status def test_update_experiment_not_authorized(client, mocker): @@ -68,12 +67,11 @@ def test_update_experiment_not_authorized(client, mocker): }] }) mocker.patch.object(DB, 'update', return_value={}) - assert '403' in client.put('/api/v2/experiments/1', - json={ - 'experiment': { - 'name': 'test', - } - }).status + assert '403' in client.put('/api/v2/experiments/1', json={ + 'experiment': { + 'name': 'test', + } + }).status def test_update_experiment(client, mocker): @@ -89,11 +87,9 @@ def test_update_experiment(client, mocker): }) mocker.patch.object(DB, 'update', return_value={}) - res = client.put( - '/api/v2/experiments/1', - json={'experiment': { - 'name': 'test', - }}) + res = client.put('/api/v2/experiments/1', json={'experiment': { + 'name': 'test', + }}) assert '200' in res.status |
