From d7b71d12aed1e24d42d2892b808f137175ce914c Mon Sep 17 00:00:00 2001 From: maike Date: Wed, 8 Jul 2020 17:10:00 +0200 Subject: [PATCH] [tests] Testing if authorization is necessary --- tests/test_api_email.py | 0 tests/test_api_email_unauthorized.py | 30 ++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 tests/test_api_email.py create mode 100644 tests/test_api_email_unauthorized.py diff --git a/tests/test_api_email.py b/tests/test_api_email.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/test_api_email_unauthorized.py b/tests/test_api_email_unauthorized.py new file mode 100644 index 0000000..ca506b1 --- /dev/null +++ b/tests/test_api_email_unauthorized.py @@ -0,0 +1,30 @@ +# Copyright (C) 2020 by Maike +# +# SPDX-License-Identifier: 0BSD + +from fastapi import status + + +def test_email_create_unauthorized(client, hood_id): + response = client.post('/api/hoods/%d/email/' % 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) + assert response.status_code == status.HTTP_401_UNAUTHORIZED + + +def test_email_subscribe(client, hood_id): + response = client.post('/api/hoods/%d/email/subscribe/' % hood_id) + assert response.status_code == status.HTTP_401_UNAUTHORIZED + + +def test_email_subscribe_confirm(client, hood_id): + response = client.post('/api/hoods/%d/email/subscribe/confirm/asdf' % hood_id) + assert response.status_code == status.HTTP_401_UNAUTHORIZED + + +def test_email_unsubscribe(client, hood_id): + response = client.get('/api/hoods/%d/email/unsubscribe/asdf' % hood_id) + assert response.status_code == status.HTTP_401_UNAUTHORIZED