From 5ec19973eb3d23046d874b097275857a58c23082 Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Wed, 7 Jul 2021 20:45:06 +0200 Subject: api: Add endpoints for accessing project relations This change adds additional endpoints to the REST API to access the project relations, the portfolios and topologies that belong to a project. --- .../opendc-web-api/tests/api/test_projects.py | 30 ++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'opendc-web/opendc-web-api/tests/api/test_projects.py') diff --git a/opendc-web/opendc-web-api/tests/api/test_projects.py b/opendc-web/opendc-web-api/tests/api/test_projects.py index c4c82e0d..1cfe4c52 100644 --- a/opendc-web/opendc-web-api/tests/api/test_projects.py +++ b/opendc-web/opendc-web-api/tests/api/test_projects.py @@ -30,6 +30,36 @@ def test_get_user_projects(client, mocker): assert '200' in res.status +def test_get_user_topologies(client, mocker): + mocker.patch.object(db, + 'fetch_one', + return_value={ + '_id': test_id, + 'authorizations': [{ + 'userId': 'test', + 'level': 'EDIT' + }] + }) + mocker.patch.object(db, 'fetch_all', return_value=[{'_id': test_id}]) + res = client.get(f'/projects/{test_id}/topologies') + assert '200' in res.status + + +def test_get_user_portfolios(client, mocker): + mocker.patch.object(db, + 'fetch_one', + return_value={ + '_id': test_id, + 'authorizations': [{ + 'userId': 'test', + 'level': 'EDIT' + }] + }) + mocker.patch.object(db, 'fetch_all', return_value=[{'_id': test_id}]) + res = client.get(f'/projects/{test_id}/portfolios') + assert '200' in res.status + + def test_add_project_missing_parameter(client): assert '400' in client.post('/projects/').status -- cgit v1.2.3