From 77880e72f2932372747efb094de414b166b1dba3 Mon Sep 17 00:00:00 2001 From: maike Date: Sat, 11 Jul 2020 04:29:44 +0200 Subject: [PATCH] [tests] Unauthorized: delete email bot, write message --- tests/test_api_email_unauthorized.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/tests/test_api_email_unauthorized.py b/tests/test_api_email_unauthorized.py index 84e5200..783621d 100644 --- a/tests/test_api_email_unauthorized.py +++ b/tests/test_api_email_unauthorized.py @@ -10,6 +10,17 @@ def test_email_create_unauthorized(client, hood_id): assert response.status_code == status.HTTP_401_UNAUTHORIZED -def test_email_delete_unauthorized(client, hood_id): - response = client.delete('/api/hoods/%d/email/' % hood_id) +def test_email_delete_unauthorized(client, hood_id, email_row): + response = client.delete('/api/hoods/%d/email/%d' % (hood_id, email_row['id'])) + assert response.status_code == status.HTTP_401_UNAUTHORIZED + + +# def test_email_delete_of_different_hood + + +def test_email_message_unauthorized(client, hood_id, email_row): + body = {"text": "test", "author": "author", "secret": "wrong"} + response = client.post( + '/api/hoods/%d/email/messages/%d' % (hood_id, email_row['id']), json=body + ) assert response.status_code == status.HTTP_401_UNAUTHORIZED