summaryrefslogtreecommitdiff
path: root/web-server/opendc/api/v2/experiments/experimentId
diff options
context:
space:
mode:
Diffstat (limited to 'web-server/opendc/api/v2/experiments/experimentId')
-rw-r--r--web-server/opendc/api/v2/experiments/experimentId/endpoint.py14
-rw-r--r--web-server/opendc/api/v2/experiments/experimentId/test_endpoint.py44
2 files changed, 34 insertions, 24 deletions
diff --git a/web-server/opendc/api/v2/experiments/experimentId/endpoint.py b/web-server/opendc/api/v2/experiments/experimentId/endpoint.py
index 2637fca7..7dacdf48 100644
--- a/web-server/opendc/api/v2/experiments/experimentId/endpoint.py
+++ b/web-server/opendc/api/v2/experiments/experimentId/endpoint.py
@@ -20,12 +20,14 @@ def PUT(request):
"""Update this Experiment."""
request.check_required_parameters(path={'experimentId': 'string'},
- body={'experiment': {
- 'topologyId': 'string',
- 'traceId': 'string',
- 'schedulerName': 'string',
- 'name': 'string',
- }})
+ body={
+ 'experiment': {
+ 'topologyId': 'string',
+ 'traceId': 'string',
+ 'schedulerName': 'string',
+ '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 0c9c9abc..35b8b762 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,15 @@ 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': {
- 'topologyId': '1',
- 'traceId': '1',
- 'schedulerName': 'default',
- 'name': 'test',
- }}).status
+ assert '404' in client.put('/api/v2/experiments/1',
+ json={
+ 'experiment': {
+ 'topologyId': '1',
+ 'traceId': '1',
+ 'schedulerName': 'default',
+ 'name': 'test',
+ }
+ }).status
def test_update_experiment_not_authorized(client, mocker):
@@ -68,12 +71,15 @@ 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': {
- 'topologyId': '1',
- 'traceId': '1',
- 'schedulerName': 'default',
- 'name': 'test',
- }}).status
+ assert '403' in client.put('/api/v2/experiments/1',
+ json={
+ 'experiment': {
+ 'topologyId': '1',
+ 'traceId': '1',
+ 'schedulerName': 'default',
+ 'name': 'test',
+ }
+ }).status
def test_update_experiment(client, mocker):
@@ -89,12 +95,14 @@ def test_update_experiment(client, mocker):
})
mocker.patch.object(DB, 'update', return_value={})
- res = client.put('/api/v2/experiments/1', json={'experiment': {
- 'topologyId': '1',
- 'traceId': '1',
- 'schedulerName': 'default',
- 'name': 'test',
- }})
+ res = client.put(
+ '/api/v2/experiments/1',
+ json={'experiment': {
+ 'topologyId': '1',
+ 'traceId': '1',
+ 'schedulerName': 'default',
+ 'name': 'test',
+ }})
assert '200' in res.status