mirror of
https://github.com/sunknudsen/privacy-guides.git
synced 2025-02-23 17:43:56 +00:00
118 lines
2.1 KiB
Plaintext
118 lines
2.1 KiB
Plaintext
#!/usr/bin/expect
|
|
|
|
source ./test.exp
|
|
|
|
set bip39_mnemonic "online pipe enough dutch decorate want moment scheme rigid enlist blast boat purse sick chalk shop brush all return betray jacket salon abandon retire"
|
|
set electrum_mnemonic "month pet slice know amused leave now vague palm guess cattle element cross truly auto put among craft repeat van sample nephew sad family"
|
|
|
|
test_label "Should format flash drive and create BIP39 mnemonic"
|
|
|
|
spawn qr-backup.sh --create-bip39-mnemonic
|
|
|
|
expect {
|
|
-re {Format USB flash drive \(y or n\)\?} {
|
|
test_send "y\r"
|
|
}
|
|
}
|
|
|
|
expect {
|
|
-re {\[sudo\] password for pi:} {
|
|
test_send "$env(password)\r"
|
|
}
|
|
}
|
|
|
|
expect {
|
|
-re {mkfs\.fat 4\.1 \(2017-01-24\)}
|
|
}
|
|
|
|
expect {
|
|
-re {Creating BIP39 mnemonic…}
|
|
}
|
|
|
|
expect {
|
|
-re {([a-z]+ ?){24}} {
|
|
test_ok true
|
|
}
|
|
eof {
|
|
test_failed
|
|
}
|
|
}
|
|
|
|
test_label "Should validate valid BIP39 mnemonic"
|
|
|
|
spawn qr-backup.sh --validate-bip39-mnemonic
|
|
|
|
expect {
|
|
-re {Format USB flash drive \(y or n\)\?} {
|
|
test_send "n\r"
|
|
}
|
|
}
|
|
|
|
expect {
|
|
-re {\[sudo\] password for pi:} {
|
|
test_send "$env(password)\r"
|
|
}
|
|
}
|
|
|
|
expect {
|
|
-re {Please type secret and press enter, then ctrl\+d} {
|
|
test_send "$bip39_mnemonic\r"
|
|
test_send "\x04"
|
|
}
|
|
}
|
|
|
|
expect {
|
|
-re {Please type secret and press enter, then ctrl\+d \(again\)} {
|
|
test_send "$bip39_mnemonic\r"
|
|
test_send "\x04"
|
|
}
|
|
}
|
|
|
|
expect {
|
|
-re {Please type passphrase and press enter} {
|
|
test_ok true
|
|
}
|
|
eof {
|
|
test_failed
|
|
}
|
|
}
|
|
|
|
test_label "Should fail to validate invalid BIP39 mnemonic"
|
|
|
|
spawn qr-backup.sh --validate-bip39-mnemonic
|
|
|
|
expect {
|
|
-re {Format USB flash drive \(y or n\)\?} {
|
|
test_send "n\r"
|
|
}
|
|
}
|
|
|
|
expect {
|
|
-re {\[sudo\] password for pi:} {
|
|
test_send "$env(password)\r"
|
|
}
|
|
}
|
|
|
|
expect {
|
|
-re {Please type secret and press enter, then ctrl\+d} {
|
|
test_send "$electrum_mnemonic\r"
|
|
test_send "\x04"
|
|
}
|
|
}
|
|
|
|
expect {
|
|
-re {Please type secret and press enter, then ctrl\+d \(again\)} {
|
|
test_send "$electrum_mnemonic\r"
|
|
test_send "\x04"
|
|
}
|
|
}
|
|
|
|
expect {
|
|
-re {Invalid BIP39 mnemonic} {
|
|
test_ok true
|
|
}
|
|
eof {
|
|
test_failed
|
|
}
|
|
}
|