This commit is contained in:
holger krekel
2022-05-06 11:51:25 +02:00
parent 7557f0d35e
commit b1fc906ec0
3 changed files with 74 additions and 40 deletions

View File

@@ -192,9 +192,7 @@ def test_fetch_existing(acfactory, lp, mvbox_move):
if mvbox_move:
assert ac.get_config("configured_mvbox_folder")
ac1 = acfactory.new_online_configuring_account(mvbox_move=mvbox_move)
ac2 = acfactory.new_online_configuring_account()
acfactory.wait_configured(ac1)
ac1, ac2 = acfactory.get_online_configured_accounts([dict(mvbox_move=mvbox_move), dict()])
ac1.direct_imap.create_folder("Sent")
ac1.set_config("sentbox_watch", "1")
@@ -203,8 +201,9 @@ def test_fetch_existing(acfactory, lp, mvbox_move):
# would also find the "Sent" folder, but it would be too late:
# The sentbox thread, started by `start_io()`, would have seen that there is no
# ConfiguredSentboxFolder and do nothing.
acfactory._acsetup.start_configure(ac1, reconfigure=True)
acfactory.force_reconfigure(ac1)
acfactory.bring_accounts_online()
assert_folders_configured(ac1)
assert ac1.direct_imap.select_config_folder("mvbox" if mvbox_move else "inbox")
@@ -220,7 +219,7 @@ def test_fetch_existing(acfactory, lp, mvbox_move):
assert_folders_configured(ac1)
lp.sec("create a cloned ac1 and fetch contact history during configure")
ac1_clone = acfactory.get_online_second_device(fetch_existing_msgs=1)
ac1_clone = acfactory.get_online_second_device(ac1, fetch_existing_msgs=1)
assert_folders_configured(ac1_clone)
lp.sec("check that ac2 contact was fetchted during configure")
@@ -245,10 +244,7 @@ def test_fetch_existing_msgs_group_and_single(acfactory, lp):
So, after fetch-existing-msgs you have one contact request and one chat with the same person.
See https://github.com/deltachat/deltachat-core-rust/issues/2097"""
ac1 = acfactory.new_online_configuring_account()
ac2 = acfactory.new_online_configuring_account()
acfactory.bring_accounts_online()
ac1, ac2 = acfactory.get_online_accounts(2)
lp.sec("receive a message")
ac2.create_group_chat("group name", contacts=[ac1]).send_text("incoming, unencrypted group message")
@@ -263,7 +259,7 @@ def test_fetch_existing_msgs_group_and_single(acfactory, lp):
assert idle1.wait_for_seen()
lp.sec("Clone online account and let it fetch the existing messages")
ac1_clone = acfactory.get_online_second_device(fetch_existing_msgs=1)
ac1_clone = acfactory.get_online_second_device(ac1, fetch_existing_msgs=1)
chats = ac1_clone.get_chats()
assert len(chats) == 4 # two newly created chats + self-chat + device-chat
@@ -276,8 +272,8 @@ def test_fetch_existing_msgs_group_and_single(acfactory, lp):
assert len(group_messages) == 1
assert group_messages[0].text == "incoming, unencrypted group message"
private_messages = private_chat.get_messages()
# We can't decrypt the message in this chat, so the chat is empty:
assert len(private_messages) == 0
assert len(private_messages) == 1
assert private_messages[0].text.startswith("outgoing, encrypted")
def test_undecipherable_group(acfactory, lp):
@@ -413,7 +409,8 @@ def test_ephemeral_timer(acfactory, lp):
def test_multidevice_sync_seen(acfactory, lp):
"""Test that message marked as seen on one device is marked as seen on another."""
ac1, ac2 = acfactory.get_online_multidevice_setup()
ac1, ac1_clone = acfactory.get_online_multidevice_setup()
ac2, = acfactory.get_online_accounts(1)
ac1.set_config("bcc_self", "1")
ac1_clone.set_config("bcc_self", "1")

View File

@@ -92,13 +92,13 @@ def test_export_import_self_keys(acfactory, tmpdir, lp):
def test_one_account_send_bcc_setting(acfactory, lp):
ac1, ac1_clone = acfactory.get_online_multidevice_setup()
ac1, ac1_clone = acfactory.get_online_multidevice_setup(copied=False)
ac2, = acfactory.get_online_accounts(1)
# test if sent messages are copied to it via BCC.
chat = acfactory.get_accepted_chat(ac1, ac2)
self_addr = ac1.get_config("addr")
other_addr = acfactory.get_online_devnull_email()
ac2_addr = ac2.get_config("addr")
lp.sec("send out message without bcc to ourselves")
ac1.set_config("bcc_self", "0")
@@ -109,9 +109,9 @@ def test_one_account_send_bcc_setting(acfactory, lp):
ev = ac1._evtracker.get_matching("DC_EVENT_SMTP_MESSAGE_SENT")
assert ac1.get_config("bcc_self") == "0"
# make sure we are not sending message to ourselves
# make sure we are NOT sending message to ourselves
assert self_addr not in ev.data2
assert other_addr in ev.data2
assert ac2_addr in ev.data2
lp.sec("ac1: setting bcc_self=1")
ac1.set_config("bcc_self", "1")
@@ -126,7 +126,7 @@ def test_one_account_send_bcc_setting(acfactory, lp):
# now make sure we are sending message to ourselves too
assert self_addr in ev.data2
assert other_addr in ev.data2
assert ac2_addr in ev.data2
assert idle1.wait_for_seen()
# Second client receives only second message, but not the first
@@ -861,17 +861,11 @@ def test_dont_show_emails(acfactory, lp):
def test_no_old_msg_is_fresh(acfactory, lp):
ac1, ac1_clone = acfactory.get_online_multidevice_setup()
ac2 = acfactory.get_online_accounts(1)
#ac1.set_config("e2ee_enabled", "0")
#ac1_clone.set_config("e2ee_enabled", "0")
#ac2.set_config("e2ee_enabled", "0")
ac2, = acfactory.get_online_accounts(1)
ac1_clone.set_config("bcc_self", "1")
ac1.create_chat(ac2)
ac1_clone.create_chat(ac2)
ac1.get_device_chat().mark_noticed()
lp.sec("Send a first message from ac2 to ac1 and check that it's 'fresh'")
@@ -883,7 +877,6 @@ def test_no_old_msg_is_fresh(acfactory, lp):
lp.sec("Send a message from ac1_clone to ac2 and check that ac1 marks the first message as 'noticed'")
ac1_clone.create_chat(ac2).send_text("Hi back")
ev = ac1._evtracker.get_matching("DC_EVENT_MSGS_NOTICED")
assert ev.data1 == first_msg_id.chat.id
assert ac1.create_chat(ac2).count_fresh_messages() == 0
assert len(list(ac1.get_fresh_messages())) == 0