[tests] Finish adapting email tests to previous changes

This commit is contained in:
Thomas Lindner 2020-07-17 15:47:55 +02:00 committed by dl6tom
parent f6f6ecdd7c
commit 761a4f9e0a
2 changed files with 3 additions and 6 deletions

View file

@ -18,10 +18,9 @@ def test_email_subscribe_unsubscribe(client, hood_id, receive_email):
mail = receive_email()
body = mail['body']
confirm_url = findall(
'http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+',
r'http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+',
body,
)[0]
print(urlparse(confirm_url).path)
response = client.post(urlparse(confirm_url).path)
assert response.status_code == status.HTTP_201_CREATED
response = client.post(urlparse(confirm_url).path)

View file

@ -1,4 +1,5 @@
# Copyright (C) 2020 by Maike <maike@systemli.org>
# Copyright (C) 2020 by Thomas Lindner <tom@dl6tom.de>
#
# SPDX-License-Identifier: 0BSD
@ -11,13 +12,10 @@ def test_email_create_unauthorized(client, hood_id):
def test_email_delete_unauthorized(client, hood_id, email_row):
response = client.delete('/api/hoods/%d/email/' % hood_id)
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/' % hood_id, json=body)