diff options
| author | Georgios Andreadis <info@gandreadis.com> | 2020-07-01 15:16:34 +0200 |
|---|---|---|
| committer | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2020-08-24 19:47:21 +0200 |
| commit | 7f27a6370a0af25e1bf6ff8f46360c6c26c21e0b (patch) | |
| tree | c146f1816322ae809b0ca419dc55db4583baa922 /web-server/opendc | |
| parent | 586d1c723dbae95424b076f26da88fcd227f2f42 (diff) | |
Restrict PUT
Diffstat (limited to 'web-server/opendc')
| -rw-r--r-- | web-server/opendc/api/v2/experiments/experimentId/endpoint.py | 10 | ||||
| -rw-r--r-- | web-server/opendc/api/v2/experiments/experimentId/test_endpoint.py | 9 |
2 files changed, 2 insertions, 17 deletions
diff --git a/web-server/opendc/api/v2/experiments/experimentId/endpoint.py b/web-server/opendc/api/v2/experiments/experimentId/endpoint.py index 5120368e..1611f889 100644 --- a/web-server/opendc/api/v2/experiments/experimentId/endpoint.py +++ b/web-server/opendc/api/v2/experiments/experimentId/endpoint.py @@ -17,14 +17,11 @@ def GET(request): def PUT(request): - """Update this Experiment.""" + """Update this Experiments name.""" request.check_required_parameters(path={'experimentId': 'string'}, body={ 'experiment': { - 'topologyId': 'string', - 'traceId': 'string', - 'schedulerName': 'string', 'name': 'string', } }) @@ -34,14 +31,11 @@ def PUT(request): experiment.check_exists() experiment.check_user_access(request.google_id, True) - experiment.set_property('topologyId', request.params_body['experiment']['topologyId']) - experiment.set_property('traceId', request.params_body['experiment']['traceId']) - experiment.set_property('schedulerName', request.params_body['experiment']['schedulerName']) experiment.set_property('name', request.params_body['experiment']['name']) experiment.update() - return Response(200, 'Successfully updated experiment', experiment.obj) + return Response(200, 'Successfully updated experiment.', experiment.obj) def DELETE(request): 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 c460585f..f3aa111c 100644 --- a/web-server/opendc/api/v2/experiments/experimentId/test_endpoint.py +++ b/web-server/opendc/api/v2/experiments/experimentId/test_endpoint.py @@ -51,9 +51,6 @@ def test_update_experiment_non_existing(client, mocker): assert '404' in client.put('/api/v2/experiments/1', json={ 'experiment': { - 'topologyId': '1', - 'traceId': '1', - 'schedulerName': 'default', 'name': 'test', } }).status @@ -74,9 +71,6 @@ def test_update_experiment_not_authorized(client, mocker): assert '403' in client.put('/api/v2/experiments/1', json={ 'experiment': { - 'topologyId': '1', - 'traceId': '1', - 'schedulerName': 'default', 'name': 'test', } }).status @@ -98,9 +92,6 @@ def test_update_experiment(client, mocker): res = client.put( '/api/v2/experiments/1', json={'experiment': { - 'topologyId': '1', - 'traceId': '1', - 'schedulerName': 'default', 'name': 'test', }}) assert '200' in res.status |
