forked from neo-project/neo-node
/
test-neo-cli.expect
executable file
·68 lines (56 loc) · 952 Bytes
/
test-neo-cli.expect
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
#!/usr/bin/expect -f
#
# This script uses expect to test neo-cli
#
set timeout 2
# Start neo-cli
spawn dotnet neo-cli.dll --rpc
# Expect the main input prompt
expect {
"neo> " { }
"error" { exit 2 }
timeout { exit 1 }
}
#
# Test 'create wallet'
#
send "create wallet test-wallet.json\n"
expect {
"password:" { send "asd\n" }
"error" { exit 2 }
timeout { exit 1 }
}
expect {
"password:" { send "asd\n" }
"error" { exit 2 }
timeout { exit 1 }
}
# Wallet creation requires a higher timeout
set timeout 10
expect {
"address:" { }
"error" { exit 2 }
timeout { exit 1 }
}
# Set timeout back to default
set timeout 2
#
# Test 'list address'
#
send "list address\n"
expect {
-re "A.*" { }
"error" { exit 2 }
timeout { exit 1 }
}
#
# Test 'create address'
#
send "create address\n"
expect {
"export addresses" { }
"neo> " { }
"error" { exit 2 }
timeout { exit 1 }
}
exit 0