kstore-cred/main_test.go

29 lines
537 B
Go
Raw Normal View History

2022-08-14 10:26:33 +00:00
package main
import (
"testing"
)
func TestAll(t *testing.T) {
test_pass := "Aa:'w\\v_ eK "
err := setAuthSecret(test_pass)
if err != nil {
t.Errorf("Cannot setAuthSecret: %s", err)
}
cred, err := getAuthSecret()
if err != nil {
t.Errorf("Cannot getAuthSecret: %s", err)
}
if string(cred.CredentialBlob) != test_pass {
t.Errorf("Retrieved credentials are not equal: %s != %s", test_pass, cred.CredentialBlob)
}
delAuthSecret()
_, err = getAuthSecret()
if err == nil {
t.Error("Unabled to del auth secret")
}
}