blob: 3f108d3b4958efeaac1fd9965731a28740e0242c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
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/
# Send messages to peers
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 $peer2_1 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 $peer2_1 hello$i" to p2
expect /dm-received from Owner2 text hello$i/ from p1
# Create contacts
local:
send "contact-request $peer1_2" to p1
expect /contact-request $peer2_1 ([0-9]*)/ from p2 capture code2
expect /contact-response $peer1_2 ([0-9]*)/ from p1 capture code1
guard (code1 == code2)
send "contact-accept $peer1_2" to p1
send "contact-accept $peer2_1" to p2
expect /contact-request-done $peer2_1/ from p2
expect /contact-response-done $peer1_2/ from p1
send "contact-list" to p1
expect from p1:
/contact-list-item ([a-z0-9#]+) Owner2 Owner2/ capture c1_2
/contact-list-(.*)/ capture done1_1
send "contact-list" to p2
expect from p2:
/contact-list-item ([a-z0-9#]+) Owner1 Owner1/ capture c2_1
/contact-list-(.*)/ capture done1_2
# Send messages to contacts
for i in [1..2]:
send "dm-send-contact $c1_2 hello$i" to p1
expect /dm-received from Owner1 text hello$i/ from p2
for i in [1..2]:
send "dm-send-contact $c2_1 hello$i" to p2
expect /dm-received from Owner2 text hello$i/ from p1
for i in [3..4]:
send "dm-send-contact $c1_2 hello$i" to p1
expect /dm-received from Owner1 text hello$i/ from p2
send "dm-send-contact $c2_1 hello$i" to p2
expect /dm-received from Owner2 text hello$i/ from p1
|