diff options
| author | Georgios Andreadis <info@gandreadis.com> | 2020-07-07 17:50:32 +0200 |
|---|---|---|
| committer | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2020-08-24 19:47:54 +0200 |
| commit | 232d27805eb598290f75c170d912a86c6b96afed (patch) | |
| tree | 2c9ed648fc2e2b2b8b066e4bd9e525a367b8a020 /web-server/opendc/api/v2/prefabs/test_endpoint.py | |
| parent | e41abaef98166dcd5c0bba75edff80ab8db9921a (diff) | |
| parent | 223e916997eb641a1662110b6de630a4cdfdf479 (diff) | |
Merge remote-tracking branch 'origin/feature/mongodb-migration' into feature/mongodb-migration
Diffstat (limited to 'web-server/opendc/api/v2/prefabs/test_endpoint.py')
| -rw-r--r-- | web-server/opendc/api/v2/prefabs/test_endpoint.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/web-server/opendc/api/v2/prefabs/test_endpoint.py b/web-server/opendc/api/v2/prefabs/test_endpoint.py new file mode 100644 index 00000000..58735ac7 --- /dev/null +++ b/web-server/opendc/api/v2/prefabs/test_endpoint.py @@ -0,0 +1,21 @@ +from opendc.util.database import DB + + +def test_add_simulation_missing_parameter(client): + assert '400' in client.post('/api/v2/prefabs').status + + +def test_add_simulation(client, mocker): + mocker.patch.object(DB, 'fetch_one', return_value={'_id': '1', 'authorizations': []}) + mocker.patch.object(DB, + 'insert', + return_value={ + '_id': '1', + 'datetimeCreated': '000', + 'datetimeLastEdited': '000' + }) + mocker.patch.object(DB, 'update', return_value={}) + res = client.post('/api/v2/prefabs', json={'prefab': {'name': 'test prefab'}}) + assert 'datetimeCreated' in res.json['content'] + assert 'datetimeLastEdited' in res.json['content'] + assert '200' in res.status |
