Added test file
This commit is contained in:
parent
7064811c12
commit
73b0afcec2
28
main_test.go
Normal file
28
main_test.go
Normal file
@ -0,0 +1,28 @@
|
||||
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")
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user