diff options
| author | Roman Smrž <roman.smrz@seznam.cz> | 2026-01-17 16:33:11 +0100 |
|---|---|---|
| committer | Roman Smrž <roman.smrz@seznam.cz> | 2026-01-18 11:41:56 +0100 |
| commit | c45dcd68255404da844f9b2c4b35c85d48da6866 (patch) | |
| tree | ced31715f77fc4256140149d4a78822a235942d6 /test/invite.et | |
| parent | b5a7a91b5ab0d6461ba399eb89db4ce5af447325 (diff) | |
Accept invites via shared state
Diffstat (limited to 'test/invite.et')
| -rw-r--r-- | test/invite.et | 67 |
1 files changed, 64 insertions, 3 deletions
diff --git a/test/invite.et b/test/invite.et index c7a8054..23047be 100644 --- a/test/invite.et +++ b/test/invite.et @@ -34,7 +34,8 @@ test InviteContact: with p2: send "invite-accept 00 $p1obase" - expect /invite-accept-done 00 invalid/ + expect /invite-accept-done 00/ + expect /invite-reply 00 invalid/ send "contact-list" expect: @@ -43,7 +44,8 @@ test InviteContact: with p2: send "invite-accept $token $p1obase" - expect /invite-accept-done $token contact/ + expect /invite-accept-done $token/ + expect /invite-reply $token contact/ send "contact-list" expect: @@ -53,7 +55,8 @@ test InviteContact: with p2: send "invite-accept $token $p1obase" - expect /invite-accept-done $token invalid/ + expect /invite-accept-done $token/ + expect /invite-reply $token invalid/ send "contact-list" expect: @@ -69,3 +72,61 @@ test InviteContact: /contact-list-item [a-z0-9#]+ Contact2 Owner2/ /contact-list-(.*)/ capture done guard (done == "done") + + +test InviteContactDelayed: + let services = "contact,invite" + + subnet s1 + subnet s2 + + spawn as p1 on s1 + spawn as p2 on s2 + + send "create-identity Device1 Owner1" to p1 + expect /create-identity-done ref ($refpat)/ from p1 capture p1id + send "identity-info $p1id" to p1 + expect /identity-info ref $p1id base ($refpat) owner ($refpat).*/ from p1 capture p1base, p1owner + send "identity-info $p1owner" to p1 + expect /identity-info ref $p1owner base ($refpat).*/ from p1 capture p1obase + + send "create-identity Device2 Owner2" to p2 + expect /create-identity-done ref ($refpat)/ from p2 capture p2id + + send "start-server services $services" to p1 + send "start-server services $services" to p2 + + send "invite-contact-create Contact2" to p1 + expect from p1 /invite-contact-create-done ([^ ]+)/ capture token + + with p2: + send "invite-accept $token $p1obase" + expect /invite-accept-done $token/ + + send to p2 "peer-add ${p1.node.ip}" + + expect from p1: + /peer ([0-9]+) addr ${p2.node.ip} 29665/ capture peer1_2 + /peer $peer1_2 id Device2 Owner2/ + + expect from p2: + /peer ([0-9]+) addr ${p1.node.ip} 29665/ capture peer2_1 + /peer $peer2_1 id Device1 Owner1/ + + with p2: + expect /invite-reply $token contact/ + + send "contact-list" + expect: + /contact-list-item [a-z0-9#]+ .*/ + /contact-list-(.*)/ capture done + guard (done == "done") + + with p1: + expect /invite-accepted $token $refpat/ + + send "contact-list" + expect: + /contact-list-item [a-z0-9#]+ Contact2 .*/ + /contact-list-(.*)/ capture done + guard (done == "done") |