mirror of
https://github.com/chatmail/core.git
synced 2026-09-22 13:01:21 +03:00
test: load test data through the data fixture
Relative paths only worked when running from `deltachat-rpc-client`.
This commit is contained in:
@@ -110,7 +110,7 @@ def test_delivery_status_failed(acfactory: ACFactory) -> None:
|
|||||||
assert failing_message.get_snapshot().state == const.MessageState.OUT_FAILED
|
assert failing_message.get_snapshot().state == const.MessageState.OUT_FAILED
|
||||||
|
|
||||||
|
|
||||||
def test_download_on_demand(acfactory: ACFactory) -> None:
|
def test_download_on_demand(acfactory: ACFactory, data) -> None:
|
||||||
"""
|
"""
|
||||||
Test if download on demand emits chatlist update events.
|
Test if download on demand emits chatlist update events.
|
||||||
This is only needed for last message in chat, but finding that out is too expensive, so it's always emitted
|
This is only needed for last message in chat, but finding that out is too expensive, so it's always emitted
|
||||||
@@ -128,7 +128,7 @@ def test_download_on_demand(acfactory: ACFactory) -> None:
|
|||||||
msg.get_snapshot().chat.accept()
|
msg.get_snapshot().chat.accept()
|
||||||
bob.get_chat_by_id(chat_id).send_message(
|
bob.get_chat_by_id(chat_id).send_message(
|
||||||
"Hello World, this message is bigger than 5 bytes",
|
"Hello World, this message is bigger than 5 bytes",
|
||||||
file="../test-data/image/screenshot.jpg",
|
file=data.get_path("image/screenshot.jpg"),
|
||||||
)
|
)
|
||||||
|
|
||||||
message = alice.wait_for_incoming_msg()
|
message = alice.wait_for_incoming_msg()
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ def test_change_address(acfactory) -> None:
|
|||||||
assert sender_addr2 == new_alice_addr
|
assert sender_addr2 == new_alice_addr
|
||||||
|
|
||||||
|
|
||||||
def test_download_on_demand(acfactory) -> None:
|
def test_download_on_demand(acfactory, data) -> None:
|
||||||
alice, bob = acfactory.get_online_accounts(2)
|
alice, bob = acfactory.get_online_accounts(2)
|
||||||
alice.set_config("download_limit", "1")
|
alice.set_config("download_limit", "1")
|
||||||
|
|
||||||
@@ -87,7 +87,7 @@ def test_download_on_demand(acfactory) -> None:
|
|||||||
|
|
||||||
alice.create_chat(bob)
|
alice.create_chat(bob)
|
||||||
chat_bob_alice = bob.create_chat(alice)
|
chat_bob_alice = bob.create_chat(alice)
|
||||||
chat_bob_alice.send_message(file="../test-data/image/screenshot.jpg")
|
chat_bob_alice.send_message(file=data.get_path("image/screenshot.jpg"))
|
||||||
msg = alice.wait_for_incoming_msg()
|
msg = alice.wait_for_incoming_msg()
|
||||||
snapshot = msg.get_snapshot()
|
snapshot = msg.get_snapshot()
|
||||||
assert snapshot.download_state == DownloadState.AVAILABLE
|
assert snapshot.download_state == DownloadState.AVAILABLE
|
||||||
|
|||||||
@@ -1412,7 +1412,7 @@ def test_synchronize_member_list_on_group_rejoin(acfactory, log):
|
|||||||
assert msg.get_snapshot().chat.num_contacts() == 2
|
assert msg.get_snapshot().chat.num_contacts() == 2
|
||||||
|
|
||||||
|
|
||||||
def test_large_message(acfactory) -> None:
|
def test_large_message(acfactory, data) -> None:
|
||||||
"""
|
"""
|
||||||
Test sending large message without download limit set,
|
Test sending large message without download limit set,
|
||||||
so it is sent with pre-message but downloaded without user interaction.
|
so it is sent with pre-message but downloaded without user interaction.
|
||||||
@@ -1422,7 +1422,7 @@ def test_large_message(acfactory) -> None:
|
|||||||
alice_chat_bob = alice.create_chat(bob)
|
alice_chat_bob = alice.create_chat(bob)
|
||||||
alice_chat_bob.send_message(
|
alice_chat_bob.send_message(
|
||||||
"Hello World, this message is bigger than 5 bytes",
|
"Hello World, this message is bigger than 5 bytes",
|
||||||
file="../test-data/image/screenshot.jpg",
|
file=data.get_path("image/screenshot.jpg"),
|
||||||
)
|
)
|
||||||
|
|
||||||
msg = bob.wait_for_incoming_msg()
|
msg = bob.wait_for_incoming_msg()
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
def test_webxdc(acfactory) -> None:
|
def test_webxdc(acfactory, data) -> None:
|
||||||
alice, bob = acfactory.get_online_accounts(2)
|
alice, bob = acfactory.get_online_accounts(2)
|
||||||
|
|
||||||
alice_contact_bob = alice.create_contact(bob, "Bob")
|
alice_contact_bob = alice.create_contact(bob, "Bob")
|
||||||
alice_chat_bob = alice_contact_bob.create_chat()
|
alice_chat_bob = alice_contact_bob.create_chat()
|
||||||
alice_chat_bob.send_message(text="Let's play chess!", file="../test-data/webxdc/chess.xdc")
|
alice_chat_bob.send_message(text="Let's play chess!", file=data.get_path("webxdc/chess.xdc"))
|
||||||
|
|
||||||
event = bob.wait_for_incoming_msg_event()
|
event = bob.wait_for_incoming_msg_event()
|
||||||
bob_chat_alice = bob.get_chat_by_id(event.chat_id)
|
bob_chat_alice = bob.get_chat_by_id(event.chat_id)
|
||||||
@@ -43,12 +43,12 @@ def test_webxdc(acfactory) -> None:
|
|||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
def test_webxdc_insert_lots_of_updates(acfactory) -> None:
|
def test_webxdc_insert_lots_of_updates(acfactory, data) -> None:
|
||||||
alice, bob = acfactory.get_online_accounts(2)
|
alice, bob = acfactory.get_online_accounts(2)
|
||||||
|
|
||||||
alice_contact_bob = alice.create_contact(bob, "Bob")
|
alice_contact_bob = alice.create_contact(bob, "Bob")
|
||||||
alice_chat_bob = alice_contact_bob.create_chat()
|
alice_chat_bob = alice_contact_bob.create_chat()
|
||||||
message = alice_chat_bob.send_message(text="Let's play chess!", file="../test-data/webxdc/chess.xdc")
|
message = alice_chat_bob.send_message(text="Let's play chess!", file=data.get_path("webxdc/chess.xdc"))
|
||||||
|
|
||||||
for i in range(2000):
|
for i in range(2000):
|
||||||
message.send_webxdc_status_update({"payload": str(i)}, "description")
|
message.send_webxdc_status_update({"payload": str(i)}, "description")
|
||||||
|
|||||||
Reference in New Issue
Block a user