git-sig/test/test.bats

66 lines
1.5 KiB
Plaintext
Raw Normal View History

2020-11-18 23:23:15 +00:00
load test_helper
@test "Outputs help if run without arguments" {
run sig
2020-11-18 23:23:15 +00:00
[ "$status" -eq 0 ]
2020-11-19 00:52:09 +00:00
echo "${output}" | grep "simple multisig trust toolchain"
}
@test "Outputs help if run with help" {
run sig help
2020-11-19 00:52:09 +00:00
[ "$status" -eq 0 ]
echo "${output}" | grep "simple multisig trust toolchain"
}
@test "Outputs version if run with version" {
run sig version
2020-11-19 00:52:09 +00:00
[ "$status" -eq 0 ]
echo "${output}" | grep "v0.0.1"
2020-11-18 23:23:15 +00:00
}
@test "Outputs advice to install missing openssl" {
2020-11-19 21:40:38 +00:00
sudo rm /usr/bin/openssl
run sig version
echo "${output}" | grep "apt install openssl"
}
@test "Outputs advice to install missing gpg" {
2020-11-19 21:40:38 +00:00
sudo rm /usr/bin/gpg
run sig version
echo "${output}" | grep "apt install gnupg"
}
@test "Outputs advice to install missing getopt" {
2020-11-19 21:40:38 +00:00
sudo rm /usr/bin/getopt
run sig version
echo "${output}" | grep "apt install getopt"
}
2020-11-19 21:40:38 +00:00
@test "Can generate manifest for git repo" {
set_identity "user1"
echo "test string" > somefile
2020-11-19 21:40:38 +00:00
git init
git add .
git commit -m "initial commit"
sig manifest
2020-11-19 21:40:38 +00:00
run grep -q "1" <(wc -l .sig/manifest.txt)
[ "$status" -eq 0 ]
run grep 37d2046a395cbfc .sig/manifest.txt
[ "$status" -eq 0 ]
}
@test "Can generate manifest for folder with git not installed" {
2020-11-19 21:40:38 +00:00
sudo rm /usr/bin/git
echo "test string" > somefile
sig manifest
run grep 37d2046a395cbfc .sig/manifest.txt
[ "$status" -eq 0 ]
}
2020-11-19 21:40:38 +00:00
@test "Can generate manifest for folder with git installed" {
echo "test string" > somefile
sig manifest
run grep 37d2046a395cbfc .sig/manifest.txt
[ "$status" -eq 0 ]
}