commit 73b0afcec2cfc1444f5ff1974f3d3ae99edf17c9
| author | 斟酌 鵬兄 <tgckpg@gmail.com> |
| date | 2022-08-14T10:26:33Z |
| subject | Added test file |
commit 73b0afcec2cfc1444f5ff1974f3d3ae99edf17c9
Author: 斟酌 鵬兄 <tgckpg@gmail.com>
Date: 2022-08-14T10:26:33Z
Added test file
---
main_test.go | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/main_test.go b/main_test.go
new file mode 100644
index 0000000..18c842e
--- /dev/null
+++ b/main_test.go
@@ -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")
+ }
+}