summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoman Smrž <roman.smrz@seznam.cz>2023-04-07 20:23:58 +0200
committerRoman Smrž <roman.smrz@seznam.cz>2023-04-07 20:23:58 +0200
commitf76b09a1dcf97e6d029aa0c8591158a6af9279d7 (patch)
tree01f41dbf34d2e45547b2b18e3ea15c48fcba1e25
parente385f66b9d0c4c1786c91926383403fa90873138 (diff)
(test) Test: direct messages to peer
-rw-r--r--message.test29
1 files changed, 29 insertions, 0 deletions
diff --git a/message.test b/message.test
new file mode 100644
index 0000000..9567611
--- /dev/null
+++ b/message.test
@@ -0,0 +1,29 @@
+test DirectMessage:
+ spawn as p1
+ spawn as p2
+ send "create-identity Device1 Owner1" to p1
+ send "create-identity Device2 Owner2" to p2
+ send "start-server" to p1
+ send "start-server" to p2
+
+ 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/
+
+ for i in [1..2]:
+ send "dm-send-peer $peer1_2 hello$i" to p1
+ expect /dm-received from Owner1 text hello$i/ from p2
+
+ for i in [1..2]:
+ send "dm-send-peer $peer1_2 hello$i" to p2
+ expect /dm-received from Owner2 text hello$i/ from p1
+
+ for i in [3..4]:
+ send "dm-send-peer $peer1_2 hello$i" to p1
+ expect /dm-received from Owner1 text hello$i/ from p2
+ send "dm-send-peer $peer1_2 hello$i" to p2
+ expect /dm-received from Owner2 text hello$i/ from p1