From 6b6f6f1c50a4dd3212b9d8c31cafc206fef6d1a0 Mon Sep 17 00:00:00 2001 From: missytake Date: Mon, 16 Oct 2023 01:51:17 +0200 Subject: [PATCH] tried to write a test to test exceeded quota, but not sure delta even gets a proper error on recipient's full mailbox --- online-tests/test_1_deltachat.py | 34 ++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/online-tests/test_1_deltachat.py b/online-tests/test_1_deltachat.py index 1439898b..7588217a 100644 --- a/online-tests/test_1_deltachat.py +++ b/online-tests/test_1_deltachat.py @@ -1,3 +1,8 @@ +import os.path +import random +import time + + class TestMailSending: def test_one_on_one(self, cmfactory, lp): ac1, ac2 = cmfactory.get_online_accounts(2) @@ -9,3 +14,32 @@ class TestMailSending: lp.sec("wait for ac2 to receive message") msg2 = ac2._evtracker.wait_next_incoming_message() assert msg2.text == "message0" + + def test_exceed_quota(self, cmfactory, lp, tmpdir): + ac1, ac2 = cmfactory.get_online_accounts(2) + chat = cmfactory.get_accepted_chat(ac1, ac2) + + ac2.set_config("download_limit", 1024 * 2) # set download_limit to 2 KB avoid downloading all those 5MB files + + lp.sec("ac1: send 25 5 MB files to ac2") + alphanumeric = "abcdefghijklmnopqrstuvwxyz1234567890" + for i in range(25): + attachment = tmpdir / f"attachment{i}" + with open(attachment, "w+") as f: + for j in range(1024 * 1024 * 5): + f.write(random.choice(alphanumeric)) + + print("Sent out msg", str(i)) + chat.send_file(str(attachment)) + + ac2.wait_next_incoming_message() + lp.sec("ac2: check that at least one message failed") + failed = False + for i in range(25): + if chat.get_messages()[i].is_out_failed(): + failed = True + print(chat.get_messages()[i].get_message_info()) + try: + assert failed + except: + import pdb; pdb.set_trace()