[tests] Testing if authorization is necessary
This commit is contained in:
parent
52a7f04313
commit
d7b71d12ae
0
tests/test_api_email.py
Normal file
0
tests/test_api_email.py
Normal file
30
tests/test_api_email_unauthorized.py
Normal file
30
tests/test_api_email_unauthorized.py
Normal file
|
@ -0,0 +1,30 @@
|
|||
# Copyright (C) 2020 by Maike <maike@systemli.org>
|
||||
#
|
||||
# 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
|
Loading…
Reference in a new issue