summaryrefslogtreecommitdiff
path: root/web-server/opendc/api/v2/topologies
diff options
context:
space:
mode:
Diffstat (limited to 'web-server/opendc/api/v2/topologies')
-rw-r--r--web-server/opendc/api/v2/topologies/topologyId/endpoint.py12
-rw-r--r--web-server/opendc/api/v2/topologies/topologyId/test_endpoint.py22
2 files changed, 17 insertions, 17 deletions
diff --git a/web-server/opendc/api/v2/topologies/topologyId/endpoint.py b/web-server/opendc/api/v2/topologies/topologyId/endpoint.py
index 1dcccb3e..512b050a 100644
--- a/web-server/opendc/api/v2/topologies/topologyId/endpoint.py
+++ b/web-server/opendc/api/v2/topologies/topologyId/endpoint.py
@@ -1,7 +1,7 @@
from datetime import datetime
from opendc.util.database import Database
-from opendc.models.simulation import Simulation
+from opendc.models.project import Project
from opendc.models.topology import Topology
from opendc.util.rest import Response
@@ -45,11 +45,11 @@ def DELETE(request):
topology.check_exists()
topology.check_user_access(request.google_id, True)
- simulation = Simulation.from_id(topology.obj['simulationId'])
- simulation.check_exists()
- if request.params_path['topologyId'] in simulation.obj['topologyIds']:
- simulation.obj['topologyIds'].remove(request.params_path['topologyId'])
- simulation.update()
+ project = Project.from_id(topology.obj['projectId'])
+ project.check_exists()
+ if request.params_path['topologyId'] in project.obj['topologyIds']:
+ project.obj['topologyIds'].remove(request.params_path['topologyId'])
+ project.update()
old_object = topology.delete()
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 d3c20de3..b25cb798 100644
--- a/web-server/opendc/api/v2/topologies/topologyId/test_endpoint.py
+++ b/web-server/opendc/api/v2/topologies/topologyId/test_endpoint.py
@@ -6,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'
}]
})
@@ -26,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'
}]
})
@@ -37,7 +37,7 @@ def test_get_topology_not_authorized(client, mocker):
def test_get_topology_no_authorizations(client, mocker):
- mocker.patch.object(DB, 'fetch_one', return_value={'simulationId': '1', 'authorizations': []})
+ mocker.patch.object(DB, 'fetch_one', return_value={'projectId': '1', 'authorizations': []})
res = client.get('/api/v2/topologies/1')
assert '403' in res.status
@@ -56,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'
}]
})
@@ -76,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'
}]
})
@@ -97,11 +97,11 @@ def test_delete_topology(client, mocker):
'fetch_one',
return_value={
'_id': '1',
- 'simulationId': '1',
+ 'projectId': '1',
'googleId': 'test',
'topologyIds': ['1'],
'authorizations': [{
- 'simulationId': '1',
+ 'projectId': '1',
'authorizationLevel': 'OWN'
}]
})