From 6493fc195214a27925800c529c33a57773b57eaa Mon Sep 17 00:00:00 2001 From: missytake Date: Fri, 8 Dec 2023 13:14:50 +0100 Subject: [PATCH] tests: xfailing test for forwarding sending errors to relay group --- tests/conftest.py | 4 +++- tests/test_bot.py | 27 +++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/tests/conftest.py b/tests/conftest.py index ab31b84..8e65c1b 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -141,7 +141,9 @@ def outsider(tmpdir): def account(db_path, show_ffi=False): - token = os.environ.get("DCC_NEW_TMP_EMAIL", "https://nine.testrun.org/cgi-bin/newemail.py") + token = os.environ.get( + "DCC_NEW_TMP_EMAIL", "https://nine.testrun.org/cgi-bin/newemail.py" + ) print(token) ac = deltachat.Account(str(db_path)) credentials = requests.post(token).json() diff --git a/tests/test_bot.py b/tests/test_bot.py index 882faab..83ebed3 100644 --- a/tests/test_bot.py +++ b/tests/test_bot.py @@ -1,4 +1,5 @@ import os.path +import time import deltachat import pytest @@ -215,3 +216,29 @@ def test_change_avatar(relaycrew): confirmation_msg = user.wait_next_incoming_message() assert confirmation_msg.text == "Avatar changed to this image." assert botcontact.get_profile_image() + + +@pytest.mark.xfail(reason="Forwarding errors is not implemented yet") +def test_forward_sending_errors_to_relay_group(relaycrew): + usercrew = relaycrew.user.get_chats()[-1] + usercrew.send_text("/start_chat alice@example.org This_Message_will_fail test") + + while len(relaycrew.bot.get_chats()) < 3: + time.sleep(0.1) + out_chat = relaycrew.bot.get_chats()[-1] + outgoing_message = out_chat.get_messages()[-1] + print(outgoing_message) + begin = int(time.time()) + while not outgoing_message.is_out_failed() and int(time.time()) < begin + 10: + time.sleep(0.1) + assert outgoing_message.is_out_failed() + while len(out_chat.get_messages()) < 3 and int(time.time()) < begin + 10: + time.sleep(0.1) + assert ( + "Recipient address rejected: Domain example.org does not accept mail" + not in out_chat.get_messages()[-1].text + ) + assert ( + "Invalid unencrypted mail to " + in out_chat.get_messages()[-1].text + )