mirror of
https://github.com/chatmail/core.git
synced 2026-05-03 13:26:28 +03:00
test: accept the chat with the caller before accepting calls
This commit is contained in:
@@ -9,6 +9,7 @@ def test_calls(acfactory) -> None:
|
|||||||
|
|
||||||
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()
|
||||||
|
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)
|
outgoing_call_message = alice_chat_bob.place_outgoing_call(place_call_info)
|
||||||
assert outgoing_call_message.get_call_info().state.kind == "Alerting"
|
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)
|
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_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.place_outgoing_call(place_call_info)
|
alice_chat_bob.place_outgoing_call(place_call_info)
|
||||||
@@ -84,3 +86,24 @@ def test_ice_servers(acfactory) -> None:
|
|||||||
|
|
||||||
ice_servers = alice.ice_servers()
|
ice_servers = alice.ice_servers()
|
||||||
assert len(ice_servers) == 1
|
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
|
||||||
|
|||||||
@@ -45,6 +45,12 @@ async fn setup_call() -> Result<CallSetup> {
|
|||||||
// Alice creates a chat with Bob and places an outgoing call there.
|
// Alice creates a chat with Bob and places an outgoing call there.
|
||||||
// Alice's other device sees the same message as an outgoing call.
|
// Alice's other device sees the same message as an outgoing call.
|
||||||
let alice_chat = alice.create_chat(&bob).await;
|
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
|
let test_msg_id = alice
|
||||||
.place_outgoing_call(alice_chat.id, PLACE_INFO.to_string())
|
.place_outgoing_call(alice_chat.id, PLACE_INFO.to_string())
|
||||||
.await?;
|
.await?;
|
||||||
|
|||||||
Reference in New Issue
Block a user