Refactored unit tests

This commit is contained in:
Sun Knudsen 2021-04-18 10:06:04 -04:00
parent aaccc14e76
commit 4980788afc
No known key found for this signature in database
GPG key ID: 1FA767862BBD1305
20 changed files with 876 additions and 769 deletions

View file

@ -1,68 +1,29 @@
#!/usr/bin/expect
# exp_internal 1
# log_file -noappend ~/expect.log
source ./test.exp
set timeout 30
proc bold {} {
return [exec tput bold]
}
proc red {} {
return [exec tput setaf 1]
}
proc green {} {
return [exec tput setaf 2]
}
proc normal {} {
return [exec tput sgr0]
}
set passphrase "asdasd"
set failed "[bold][red]Failed[normal]"
set ok "[bold][green]OK[normal]"
puts "[bold]Should create Electrum mnemonic[normal]"
test_label "Should create Electrum mnemonic"
spawn qr-backup.sh --create-electrum-mnemonic
expect {
default {
puts $failed
exit 1
}
-re {Format USB flash drive \(y or n\)\?} {
send "n\r"
test_send "n\r"
}
}
expect {
default {
puts $failed
exit 1
}
-re {\[sudo\] password for pi:} {
send "$env(password)\r"
test_send "$env(password)\r"
}
}
expect {
default {
puts $failed
exit 1
}
-re {Creating Electrum mnemonic…}
}
expect {
default {
puts $failed
exit 1
}
-re {(([a-z]+ ?){24})} {
puts $ok
exit 0
-re {([a-z]+ ?){24}} {
test_ok true
}
}
interact