Skip to content

Commit

Permalink
fixup! fix: do not create ad-hoc groups from partial downloads
Browse files Browse the repository at this point in the history
  • Loading branch information
link2xt committed Apr 11, 2024
1 parent b86eb58 commit 5ea05e2
Showing 1 changed file with 8 additions and 14 deletions.
22 changes: 8 additions & 14 deletions deltachat-rpc-client/tests/test_something.py
Original file line number Diff line number Diff line change
Expand Up @@ -540,19 +540,9 @@ def test_reactions_for_a_reordering_move(acfactory):
assert list(reactions.reactions_by_contact.values())[0] == [react_str]


@pytest.mark.parametrize("multiuser", [True, False])
def test_download_limit_chat_assignment(acfactory, tmp_path, multiuser):
@pytest.mark.parametrize("n_accounts", [3, 2])
def test_download_limit_chat_assignment(acfactory, tmp_path, n_accounts):
download_limit = 300000
if multiuser:
# Create three accounts for a group.
n_accounts = 3
else:
# More difficult case.
#
# Group contains only Alice and Bob,
# so partially downloaded messages are
# hard to distinguish from private replies to group messages.
n_accounts = 2

alice, *others = acfactory.get_online_accounts(n_accounts)
bob = others[0]
Expand All @@ -568,7 +558,7 @@ def test_download_limit_chat_assignment(acfactory, tmp_path, multiuser):

alice_group.add_contact(contact)

if not multiuser:
if n_accounts == 2:
bob_chat_alice = bob.create_chat(alice)
bob.set_config("download_limit", str(download_limit))

Expand All @@ -585,8 +575,12 @@ def test_download_limit_chat_assignment(acfactory, tmp_path, multiuser):
alice_group.send_file(str(path))
snapshot = bob.get_message_by_id(bob.wait_for_incoming_msg_event().msg_id).get_snapshot()
assert snapshot.download_state == DownloadState.AVAILABLE
if multiuser:
if n_accounts > 2:
assert snapshot.chat == bob_group
else:
# Group contains only Alice and Bob,
# so partially downloaded messages are
# hard to distinguish from private replies to group messages.
#
# Message may be a private reply, so we assign it to 1:1 chat with Alice.
assert snapshot.chat == bob_chat_alice

0 comments on commit 5ea05e2

Please sign in to comment.