summaryrefslogtreecommitdiff
path: root/opendc-web/opendc-web-api/opendc/api/v2/users/test_endpoint.py
diff options
context:
space:
mode:
authorFabian Mastenbroek <mail.fabianm@gmail.com>2021-05-14 16:50:23 +0200
committerFabian Mastenbroek <mail.fabianm@gmail.com>2021-05-17 17:06:51 +0200
commit05d2318538eba71ac0555dc5ec146499d9cb0592 (patch)
tree6163e6429879109e322a4c0883fab168031aa109 /opendc-web/opendc-web-api/opendc/api/v2/users/test_endpoint.py
parent0c6ccca5fac44ab40671627fd3181e9b138672fa (diff)
api: Remove user handling from OpenDC API server
This change removes any of the user handling and endpoints from the OpenDC API server. The API server does not need to store user information other than an identifier in the database.
Diffstat (limited to 'opendc-web/opendc-web-api/opendc/api/v2/users/test_endpoint.py')
-rw-r--r--opendc-web/opendc-web-api/opendc/api/v2/users/test_endpoint.py34
1 files changed, 0 insertions, 34 deletions
diff --git a/opendc-web/opendc-web-api/opendc/api/v2/users/test_endpoint.py b/opendc-web/opendc-web-api/opendc/api/v2/users/test_endpoint.py
deleted file mode 100644
index 13b63b20..00000000
--- a/opendc-web/opendc-web-api/opendc/api/v2/users/test_endpoint.py
+++ /dev/null
@@ -1,34 +0,0 @@
-from opendc.util.database import DB
-
-
-def test_get_user_by_email_missing_parameter(client):
- assert '400' in client.get('/v2/users').status
-
-
-def test_get_user_by_email_non_existing(client, mocker):
- mocker.patch.object(DB, 'fetch_one', return_value=None)
- assert '404' in client.get('/v2/users?email=test@test.com').status
-
-
-def test_get_user_by_email(client, mocker):
- mocker.patch.object(DB, 'fetch_one', return_value={'email': 'test@test.com'})
- res = client.get('/v2/users?email=test@test.com')
- assert 'email' in res.json['content']
- assert '200' in res.status
-
-
-def test_add_user_missing_parameter(client):
- assert '400' in client.post('/v2/users').status
-
-
-def test_add_user_existing(client, mocker):
- mocker.patch.object(DB, 'fetch_one', return_value={'email': 'test@test.com'})
- assert '409' in client.post('/v2/users', json={'user': {'email': 'test@test.com'}}).status
-
-
-def test_add_user(client, mocker):
- mocker.patch.object(DB, 'fetch_one', return_value=None)
- mocker.patch.object(DB, 'insert', return_value={'email': 'test@test.com'})
- res = client.post('/v2/users', json={'user': {'email': 'test@test.com'}})
- assert 'email' in res.json['content']
- assert '200' in res.status