Refactored unit tests
This commit is contained in:
parent
aaccc14e76
commit
4980788afc
20 changed files with 876 additions and 769 deletions
69
how-to-create-encrypted-paper-backup/tests/duplicate.exp
Normal file
69
how-to-create-encrypted-paper-backup/tests/duplicate.exp
Normal file
|
@ -0,0 +1,69 @@
|
|||
#!/usr/bin/expect
|
||||
|
||||
source ./test.exp
|
||||
|
||||
set secret "foo\nbar"
|
||||
set passphrase "asdasd"
|
||||
|
||||
test_label "Should duplicate backup"
|
||||
|
||||
source ./tests/helpers/backup.exp
|
||||
|
||||
spawn qr-clone.sh --duplicate --qr-restore-options "--images $short_hash.jpg"
|
||||
|
||||
expect {
|
||||
-re {Restoring…}
|
||||
}
|
||||
|
||||
expect {
|
||||
-re {\[sudo\] password for pi:} {
|
||||
test_send "$env(password)\r"
|
||||
}
|
||||
}
|
||||
|
||||
expect {
|
||||
-re {Done}
|
||||
}
|
||||
|
||||
expect {
|
||||
-re {Backing up…}
|
||||
}
|
||||
|
||||
expect {
|
||||
-re {Format USB flash drive \(y or n\)\?} {
|
||||
test_send "n\r"
|
||||
}
|
||||
}
|
||||
|
||||
expect {
|
||||
-re {SHA512 short hash: .+?([a-f0-9]{8})} {
|
||||
set new_short_hash $expect_out(1,string)
|
||||
}
|
||||
}
|
||||
|
||||
expect {
|
||||
-re {Show SHA512 hash as QR code \(y or n\)\?} {
|
||||
test_send "n\r"
|
||||
}
|
||||
}
|
||||
|
||||
expect {
|
||||
-re {Done}
|
||||
}
|
||||
|
||||
if { "$new_short_hash" != "$short_hash" } {
|
||||
test_failed
|
||||
}
|
||||
|
||||
set short_hash "$new_short_hash"
|
||||
|
||||
source ./tests/helpers/restore.exp
|
||||
|
||||
regsub -all {(\e\(B)?\e\[[0-9]*?m} $restored_secret {} restored_secret
|
||||
regsub -all {\r} $restored_secret {} restored_secret
|
||||
|
||||
if { "$restored_secret" != "$secret" } {
|
||||
test_failed
|
||||
} else {
|
||||
test_ok
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue