MCPcopy Create free account
hub / github.com/chatmail/core / test_wrong_auth_token

Function test_wrong_auth_token

src/securejoin/securejoin_tests.rs:986–1014  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

984
985#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
986async fn test_wrong_auth_token() -> Result<()> {
987 let mut tcm = TestContextManager::new();
988 let alice = &tcm.alice().await;
989 let bob = &tcm.bob().await;
990
991 // Bob should already have Alice's key
992 // so that he can directly send vc-request-with-auth
993 tcm.send_recv(alice, bob, "hi").await;
994
995 let alice_qr = get_securejoin_qr(alice, None).await?;
996 println!("{alice_qr}");
997 let invalid_alice_qr = alice_qr.replace("&s=", "&s=INVALIDAUTHTOKEN&someotherkey=");
998
999 join_securejoin(bob, &invalid_alice_qr).await?;
1000 let sent = bob.pop_sent_msg().await;
1001
1002 let msg = alice.parse_msg(&sent).await;
1003 assert_eq!(
1004 msg.get_header(HeaderDef::SecureJoin).unwrap(),
1005 "vc-request-with-auth"
1006 );
1007
1008 alice.recv_msg_trash(&sent).await;
1009
1010 let alice_bob_contact = alice.add_or_lookup_contact(bob).await;
1011 assert!(!alice_bob_contact.is_verified(alice).await?);
1012
1013 Ok(())
1014}
1015
1016#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
1017async fn test_send_avatar_in_securejoin() -> Result<()> {

Callers

nothing calls this directly

Calls 9

get_securejoin_qrFunction · 0.85
join_securejoinFunction · 0.85
aliceMethod · 0.80
bobMethod · 0.80
send_recvMethod · 0.80
pop_sent_msgMethod · 0.80
parse_msgMethod · 0.80
recv_msg_trashMethod · 0.80
add_or_lookup_contactMethod · 0.80

Tested by

no test coverage detected