summaryrefslogtreecommitdiff
path: root/web-server/opendc/api/v2/projects/projectId/topologies/test_endpoint.py
diff options
context:
space:
mode:
authorFabian Mastenbroek <mail.fabianm@gmail.com>2020-07-14 21:10:56 +0200
committerFabian Mastenbroek <mail.fabianm@gmail.com>2020-08-24 19:48:04 +0200
commit02997b2522b9c66072b16f1425c02e81e0085e3c (patch)
treeeb8cb533e3ef37a11598e86736b063293f8b0e2b /web-server/opendc/api/v2/projects/projectId/topologies/test_endpoint.py
parent1a4776636bf6b585d4a19a6721d9d57b02c88ca4 (diff)
Rename web-server to API
This change renames the web-server component to API in order to be more descriptive of its role. The OpenDC API bridges between the frontend on one side and the database and simulator on the other side.
Diffstat (limited to 'web-server/opendc/api/v2/projects/projectId/topologies/test_endpoint.py')
-rw-r--r--web-server/opendc/api/v2/projects/projectId/topologies/test_endpoint.py50
1 files changed, 0 insertions, 50 deletions
diff --git a/web-server/opendc/api/v2/projects/projectId/topologies/test_endpoint.py b/web-server/opendc/api/v2/projects/projectId/topologies/test_endpoint.py
deleted file mode 100644
index ca123a73..00000000
--- a/web-server/opendc/api/v2/projects/projectId/topologies/test_endpoint.py
+++ /dev/null
@@ -1,50 +0,0 @@
-from opendc.util.database import DB
-
-
-def test_add_topology_missing_parameter(client):
- assert '400' in client.post('/api/v2/projects/1/topologies').status
-
-
-def test_add_topology(client, mocker):
- mocker.patch.object(DB,
- 'fetch_one',
- return_value={
- '_id': '1',
- 'authorizations': [{
- 'projectId': '1',
- 'authorizationLevel': 'OWN'
- }],
- 'topologyIds': []
- })
- mocker.patch.object(DB,
- 'insert',
- return_value={
- '_id': '1',
- 'datetimeCreated': '000',
- 'datetimeLastEdited': '000',
- 'topologyIds': []
- })
- mocker.patch.object(DB, 'update', return_value={})
- res = client.post('/api/v2/projects/1/topologies', json={'topology': {'name': 'test project', 'rooms': []}})
- assert 'rooms' in res.json['content']
- assert '200' in res.status
-
-
-def test_add_topology_not_authorized(client, mocker):
- mocker.patch.object(DB,
- 'fetch_one',
- return_value={
- '_id': '1',
- 'projectId': '1',
- 'authorizations': [{
- 'projectId': '1',
- 'authorizationLevel': 'VIEW'
- }]
- })
- assert '403' in client.post('/api/v2/projects/1/topologies',
- json={
- 'topology': {
- 'name': 'test_topology',
- 'rooms': {}
- }
- }).status