From 761a4f9e0a47f0c1e042728e303eac7646224355 Mon Sep 17 00:00:00 2001 From: Thomas Lindner Date: Fri, 17 Jul 2020 15:47:55 +0200 Subject: [PATCH] [tests] Finish adapting email tests to previous changes --- tests/test_api_email_happy_path.py | 3 +-- tests/test_api_email_unauthorized.py | 6 ++---- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/tests/test_api_email_happy_path.py b/tests/test_api_email_happy_path.py index 97db38f..27e18bc 100644 --- a/tests/test_api_email_happy_path.py +++ b/tests/test_api_email_happy_path.py @@ -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) diff --git a/tests/test_api_email_unauthorized.py b/tests/test_api_email_unauthorized.py index cc31ecc..5be5c8e 100644 --- a/tests/test_api_email_unauthorized.py +++ b/tests/test_api_email_unauthorized.py @@ -1,4 +1,5 @@ # Copyright (C) 2020 by Maike +# Copyright (C) 2020 by Thomas Lindner # # 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)