Skip to content

Commit e8a4c92

Browse files
committed
test: accept the chat with the caller before accepting calls
1 parent 4a0b180 commit e8a4c92

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

deltachat-rpc-client/tests/test_calls.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ def test_calls(acfactory) -> None:
99

1010
alice_contact_bob = alice.create_contact(bob, "Bob")
1111
alice_chat_bob = alice_contact_bob.create_chat()
12+
bob.create_chat(alice) # Accept the chat so incoming call causes a notification.
1213
outgoing_call_message = alice_chat_bob.place_outgoing_call(place_call_info)
1314
assert outgoing_call_message.get_call_info().state.kind == "Alerting"
1415

@@ -67,6 +68,7 @@ def test_video_call(acfactory) -> None:
6768

6869
alice, bob = acfactory.get_online_accounts(2)
6970

71+
bob.create_chat(alice) # Accept the chat so incoming call causes a notification.
7072
alice_contact_bob = alice.create_contact(bob, "Bob")
7173
alice_chat_bob = alice_contact_bob.create_chat()
7274
alice_chat_bob.place_outgoing_call(place_call_info)
@@ -84,3 +86,24 @@ def test_ice_servers(acfactory) -> None:
8486

8587
ice_servers = alice.ice_servers()
8688
assert len(ice_servers) == 1
89+
90+
91+
def test_no_contact_request_call(acfactory) -> None:
92+
alice, bob = acfactory.get_online_accounts(2)
93+
94+
alice_chat_bob = alice.create_chat(bob)
95+
alice_chat_bob.place_outgoing_call("offer")
96+
alice_chat_bob.send_text("Hello!")
97+
98+
# Notification for "Hello!" message should arrive
99+
# without the call ringing.
100+
while True:
101+
event = bob.wait_for_event()
102+
103+
# There should be no incoming call notification.
104+
assert event.kind != EventType.INCOMING_CALL
105+
106+
if event.kind == EventType.INCOMING_MSG:
107+
msg = bob.get_message_by_id(event.msg_id)
108+
assert msg.get_snapshot().text == "Hello!"
109+
break

src/calls/calls_tests.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,12 @@ async fn setup_call() -> Result<CallSetup> {
4545
// Alice creates a chat with Bob and places an outgoing call there.
4646
// Alice's other device sees the same message as an outgoing call.
4747
let alice_chat = alice.create_chat(&bob).await;
48+
49+
// Create chat on Bob's side
50+
// so incoming call causes a notification.
51+
bob.create_chat(&alice).await;
52+
bob2.create_chat(&alice).await;
53+
4854
let test_msg_id = alice
4955
.place_outgoing_call(alice_chat.id, PLACE_INFO.to_string())
5056
.await?;

0 commit comments

Comments
 (0)