in progress integration tests

This commit is contained in:
David Dworken
2022-01-09 11:00:53 -08:00
parent a523504c40
commit 3d450a1175
12 changed files with 283 additions and 109 deletions

View File

@@ -11,14 +11,14 @@ func TestSetup(t *testing.T) {
defer BackupAndRestore(t)
homedir, err := os.UserHomeDir()
Check(t, err)
if _, err := os.Stat(path.Join(homedir, SECRET_PATH)); err == nil {
if _, err := os.Stat(path.Join(homedir, CONFIG_PATH)); err == nil {
t.Fatalf("hishtory secret file already exists!")
}
Check(t, Setup([]string{}))
if _, err := os.Stat(path.Join(homedir, SECRET_PATH)); err != nil {
if _, err := os.Stat(path.Join(homedir, CONFIG_PATH)); err != nil {
t.Fatalf("hishtory secret file does not exist after Setup()!")
}
data, err := os.ReadFile(path.Join(homedir, SECRET_PATH))
data, err := os.ReadFile(path.Join(homedir, CONFIG_PATH))
Check(t, err)
if len(data) < 10 {
t.Fatalf("hishtory secret has unexpected length: %d", len(data))