aboutsummaryrefslogtreecommitdiff
path: root/src/tests/test_api.py
diff options
context:
space:
mode:
authorneodarz <neodarz@neodarz.net>2018-08-19 13:10:04 +0200
committerneodarz <neodarz@neodarz.net>2018-08-19 13:10:04 +0200
commit2a9518c9e771c9eec67aa25ee0d1e2e8b8195892 (patch)
tree46dc7d03c50d1c776e45a5d5a2580ffa8115e4df /src/tests/test_api.py
parent7867863b6cd21a87b97df7cabd6871f6a5204602 (diff)
downloadliberationCenter-master.tar.xz
liberationCenter-master.zip
Use status code instead of simple message for testingHEADmaster
Diffstat (limited to '')
-rw-r--r--src/tests/test_api.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/tests/test_api.py b/src/tests/test_api.py
index 063f32f..741780e 100644
--- a/src/tests/test_api.py
+++ b/src/tests/test_api.py
@@ -11,12 +11,12 @@ def test_api_get_all_users(client, app):
assert response.is_json
assert re.search('username', str(response.data))
-@pytest.mark.parametrize(('username', 'message'), (
- ('', b'{"msg": "Username is required."}'),
- ('neo', b'{"msg": "User neo is already registered."}'),
- ('neodarz', b'{"msg": "done"}')
+@pytest.mark.parametrize(('username', 'code'), (
+ ('', 400),
+ ('neo', 409),
+ ('neodarz', 201)
))
-def test_api_register(client, app, username, message):
+def test_api_register(client, app, username, code):
response = client.post('/api/user/register', data='{"username": "'+username+'"}')
print(response.data)
- assert message in response.data
+ assert code == response.status_code