summaryrefslogtreecommitdiff
path: root/web-server/opendc/api/v2/topologies/topologyId/test_endpoint.py
diff options
context:
space:
mode:
Diffstat (limited to 'web-server/opendc/api/v2/topologies/topologyId/test_endpoint.py')
-rw-r--r--web-server/opendc/api/v2/topologies/topologyId/test_endpoint.py35
1 files changed, 11 insertions, 24 deletions
diff --git a/web-server/opendc/api/v2/topologies/topologyId/test_endpoint.py b/web-server/opendc/api/v2/topologies/topologyId/test_endpoint.py
index fa88c497..b25cb798 100644
--- a/web-server/opendc/api/v2/topologies/topologyId/test_endpoint.py
+++ b/web-server/opendc/api/v2/topologies/topologyId/test_endpoint.py
@@ -1,7 +1,4 @@
from opendc.util.database import DB
-'''
-GET /topologies/{topologyId}
-'''
def test_get_topology(client, mocker):
@@ -9,9 +6,9 @@ def test_get_topology(client, mocker):
'fetch_one',
return_value={
'_id': '1',
- 'simulationId': '1',
+ 'projectId': '1',
'authorizations': [{
- 'simulationId': '1',
+ 'projectId': '1',
'authorizationLevel': 'EDIT'
}]
})
@@ -29,9 +26,9 @@ def test_get_topology_not_authorized(client, mocker):
'fetch_one',
return_value={
'_id': '1',
- 'simulationId': '1',
+ 'projectId': '1',
'authorizations': [{
- 'simulationId': '2',
+ 'projectId': '2',
'authorizationLevel': 'OWN'
}]
})
@@ -40,16 +37,11 @@ def test_get_topology_not_authorized(client, mocker):
def test_get_topology_no_authorizations(client, mocker):
- mocker.patch.object(DB, 'fetch_one', return_value={'authorizations': []})
+ mocker.patch.object(DB, 'fetch_one', return_value={'projectId': '1', 'authorizations': []})
res = client.get('/api/v2/topologies/1')
assert '403' in res.status
-'''
-PUT /topologies/{topologyId}
-'''
-
-
def test_update_topology_missing_parameter(client):
assert '400' in client.put('/api/v2/topologies/1').status
@@ -64,9 +56,9 @@ def test_update_topology_not_authorized(client, mocker):
'fetch_one',
return_value={
'_id': '1',
- 'simulationId': '1',
+ 'projectId': '1',
'authorizations': [{
- 'simulationId': '1',
+ 'projectId': '1',
'authorizationLevel': 'VIEW'
}]
})
@@ -84,9 +76,9 @@ def test_update_topology(client, mocker):
'fetch_one',
return_value={
'_id': '1',
- 'simulationId': '1',
+ 'projectId': '1',
'authorizations': [{
- 'simulationId': '1',
+ 'projectId': '1',
'authorizationLevel': 'OWN'
}]
})
@@ -100,21 +92,16 @@ def test_update_topology(client, mocker):
}).status
-'''
-DELETE /topologies/{topologyId}
-'''
-
-
def test_delete_topology(client, mocker):
mocker.patch.object(DB,
'fetch_one',
return_value={
'_id': '1',
- 'simulationId': '1',
+ 'projectId': '1',
'googleId': 'test',
'topologyIds': ['1'],
'authorizations': [{
- 'simulationId': '1',
+ 'projectId': '1',
'authorizationLevel': 'OWN'
}]
})