invitation ajustments
This commit is contained in:
1 parent
6ac21ccf4c
commit
7eed94d82c
5 files changed
+188
-54
No files matched your search
@@ -820,3 +820,32 @@ async fn background_task_wakes_up_on_new_contacts() {
|
||||
bob.stop().await;
|
||||
let _ = std::fs::remove_dir_all(&dir);
|
||||
}
|
||||
|
||||
/// One-shot invitation (QR code, file, nearby): only the offer travels out of band.
|
||||
#[tokio::test(flavor = "multi_thread")]
|
||||
async fn one_shot_invitation_completes_through_servers() {
|
||||
let servers = vec![spawn_server().await];
|
||||
let dir = tmpdir();
|
||||
let mut alice = client(&dir, "alice", &servers).await;
|
||||
let mut bob = client(&dir, "bob", &servers).await;
|
||||
let offer = alice
|
||||
.create_invitation("Bob", &[], "scan me", 3600, None)
|
||||
.await
|
||||
.unwrap();
|
||||
assert_eq!(bob.accept_invitation(&offer, None, &[], None).await.unwrap(), "alice");
|
||||
// Accepting twice is refused.
|
||||
assert!(bob.accept_invitation(&offer, Some("other"), &[], None).await.is_err());
|
||||
assert_eq!(
|
||||
no_receipts(alice.sync(Duration::ZERO).await.unwrap()),
|
||||
vec![Event::InvitationAccepted { contact: "Bob".into() }]
|
||||
);
|
||||
bob.sync(Duration::ZERO).await.unwrap();
|
||||
alice.sync(Duration::ZERO).await.unwrap();
|
||||
assert_eq!(alice.contact("Bob").unwrap().state, State::Active);
|
||||
assert_eq!(bob.contact("alice").unwrap().state, State::Active);
|
||||
assert_eq!(
|
||||
alice.contact("Bob").unwrap().safety_number(),
|
||||
bob.contact("alice").unwrap().safety_number()
|
||||
);
|
||||
let _ = std::fs::remove_dir_all(&dir);
|
||||
}
|
||||
Reference in new issue
Block a user