From d3eb209d2709cf7c6d47cfa6c6c659440923d60e Mon Sep 17 00:00:00 2001 From: Alexander Krotov Date: Sun, 12 Jul 2020 22:37:28 +0300 Subject: [PATCH] Add test for immediate server deletion --- python/tests/test_account.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/python/tests/test_account.py b/python/tests/test_account.py index 526c98c4a..5ebe85fff 100644 --- a/python/tests/test_account.py +++ b/python/tests/test_account.py @@ -1542,6 +1542,32 @@ class TestOnlineAccount: assert msg.is_encrypted(), "Message is not encrypted" assert msg.chat == ac2.create_chat(ac4) + @pytest.mark.xfail + def test_immediate_autodelete(self, acfactory, lp): + ac1 = acfactory.get_online_configuring_account() + ac2 = acfactory.get_online_configuring_account(mvbox=False, move=False, sentbox=False) + + # "1" means delete immediately, while "0" means do not delete + ac2.set_config("delete_server_after", "1") + + acfactory.wait_configure_and_start_io() + + imap = ac2.direct_imap + imap.idle_start() + + lp.sec("ac1: create chat with ac2") + chat1 = ac1.create_chat(ac2) + ac2.create_chat(ac1) + + chat1.send_text("hello") + imap.idle_check(terminate=False) + + msg = ac2._evtracker.wait_next_incoming_message() + assert msg.text == "hello" + + imap.idle_check(terminate=True) + assert len(imap.get_all_messages()) == 0 + def test_ephemeral_timer(self, acfactory, lp): ac1, ac2 = acfactory.get_two_online_accounts()