From e8a4c9237dd75cc71edde653b0618f4ba8cc1100 Mon Sep 17 00:00:00 2001 From: link2xt Date: Fri, 17 Oct 2025 09:13:18 +0000 Subject: [PATCH] test: accept the chat with the caller before accepting calls --- deltachat-rpc-client/tests/test_calls.py | 23 +++++++++++++++++++++++ src/calls/calls_tests.rs | 6 ++++++ 2 files changed, 29 insertions(+) diff --git a/deltachat-rpc-client/tests/test_calls.py b/deltachat-rpc-client/tests/test_calls.py index 6ea4810fc..e83d736f0 100644 --- a/deltachat-rpc-client/tests/test_calls.py +++ b/deltachat-rpc-client/tests/test_calls.py @@ -9,6 +9,7 @@ def test_calls(acfactory) -> None: alice_contact_bob = alice.create_contact(bob, "Bob") alice_chat_bob = alice_contact_bob.create_chat() + bob.create_chat(alice) # Accept the chat so incoming call causes a notification. outgoing_call_message = alice_chat_bob.place_outgoing_call(place_call_info) assert outgoing_call_message.get_call_info().state.kind == "Alerting" @@ -67,6 +68,7 @@ a=extmap:1 urn:ietf:params:rtp-hdrext:sdes:mid\r alice, bob = acfactory.get_online_accounts(2) + bob.create_chat(alice) # Accept the chat so incoming call causes a notification. alice_contact_bob = alice.create_contact(bob, "Bob") alice_chat_bob = alice_contact_bob.create_chat() alice_chat_bob.place_outgoing_call(place_call_info) @@ -84,3 +86,24 @@ def test_ice_servers(acfactory) -> None: ice_servers = alice.ice_servers() assert len(ice_servers) == 1 + + +def test_no_contact_request_call(acfactory) -> None: + alice, bob = acfactory.get_online_accounts(2) + + alice_chat_bob = alice.create_chat(bob) + alice_chat_bob.place_outgoing_call("offer") + alice_chat_bob.send_text("Hello!") + + # Notification for "Hello!" message should arrive + # without the call ringing. + while True: + event = bob.wait_for_event() + + # There should be no incoming call notification. + assert event.kind != EventType.INCOMING_CALL + + if event.kind == EventType.INCOMING_MSG: + msg = bob.get_message_by_id(event.msg_id) + assert msg.get_snapshot().text == "Hello!" + break diff --git a/src/calls/calls_tests.rs b/src/calls/calls_tests.rs index 9ad40efeb..3f983d843 100644 --- a/src/calls/calls_tests.rs +++ b/src/calls/calls_tests.rs @@ -45,6 +45,12 @@ async fn setup_call() -> Result { // Alice creates a chat with Bob and places an outgoing call there. // Alice's other device sees the same message as an outgoing call. let alice_chat = alice.create_chat(&bob).await; + + // Create chat on Bob's side + // so incoming call causes a notification. + bob.create_chat(&alice).await; + bob2.create_chat(&alice).await; + let test_msg_id = alice .place_outgoing_call(alice_chat.id, PLACE_INFO.to_string()) .await?;