go-spectre @main -
refs -
log -
-
https://git.jolheiser.com/go-spectre.git
Signature
-----BEGIN SSH SIGNATURE-----
U1NIU0lHAAAAAQAAADMAAAALc3NoLWVkMjU1MTkAAAAgBTEvCQk6VqUAdN2RuH6bj1dNkY
oOpbPWj+jw4ua1B1cAAAADZ2l0AAAAAAAAAAZzaGE1MTIAAABTAAAAC3NzaC1lZDI1NTE5
AAAAQMIqvF5NQ82cwTnr3wAERL8Fik/RGr2Y0nAUnMDM3sFGLAGxMLqhoe2U59x9muKQ4e
uX/esZc24qLxkN3EBW8wI=
-----END SSH SIGNATURE-----
diff --git a/cmd/spectre/main_test.go b/cmd/spectre/main_test.go
index 893b7d54581fd5d7e5f66ac128b5c665a52bc147..65ea73f67e89139cf1a6dad30f25a248a1c1eadf 100644
--- a/cmd/spectre/main_test.go
+++ b/cmd/spectre/main_test.go
@@ -2,6 +2,7 @@ package main
import (
_ "embed"
+ "os"
"testing"
"go.jolheiser.com/go-spectre/testdata"
@@ -15,6 +16,8 @@ if err != nil {
t.Log(err)
t.FailNow()
}
+
+ tmp := t.TempDir()
for _, tc := range cases {
t.Run(tc.ID, func(t *testing.T) {
@@ -30,6 +33,32 @@ tc.SiteName,
}
pw, err := maine(args)
+ if err != nil {
+ t.Log(err)
+ t.FailNow()
+ }
+
+ if pw != tc.Result {
+ t.Log("passwords did not match")
+ t.Fail()
+ }
+
+ // Test with secret-file as well
+ sf, err := os.CreateTemp(tmp, "spectre*")
+ if err != nil {
+ t.Log(err)
+ t.FailNow()
+ }
+ defer sf.Close()
+ if _, err := sf.WriteString(tc.UserSecret); err != nil {
+ t.Log(err)
+ t.FailNow()
+ }
+
+ args[3] = "" // --secret
+ args[5] = sf.Name() // --secret-file
+
+ pw, err = maine(args)
if err != nil {
t.Log(err)
t.FailNow()