commit 44f8efd6703c4a3b2fca341fb8886eed39c86368
parent c2c7c6d581fded00910515b8f78fc5d4414aadb7
Author: Sean Enck <sean@ttypty.com>
Date: Mon, 10 Oct 2022 19:45:30 -0400
test for totp field name
Diffstat:
1 file changed, 9 insertions(+), 0 deletions(-)
diff --git a/internal/backend/actions_test.go b/internal/backend/actions_test.go
@@ -17,6 +17,7 @@ func fullSetup(t *testing.T, keep bool) *backend.Transaction {
os.Setenv("LOCKBOX_STORE", "test.kdbx")
os.Setenv("LOCKBOX_KEY", "test")
os.Setenv("LOCKBOX_KEYMODE", "plaintext")
+ os.Setenv("LOCKBOX_TOTP", "totp")
tr, err := backend.NewTransaction()
if err != nil {
t.Errorf("failed: %v", err)
@@ -37,6 +38,14 @@ func TestNoWriteOnRO(t *testing.T) {
}
}
+func TestBadTOTP(t *testing.T) {
+ tr := setup(t)
+ os.Setenv("LOCKBOX_TOTP", "Title")
+ if err := tr.Insert("a/a/a", "a"); err.Error() != "invalid totp field, uses restricted name" {
+ t.Errorf("wrong error: %v", err)
+ }
+}
+
func TestBadAction(t *testing.T) {
tr := &backend.Transaction{}
if err := tr.Insert("a/a/a", "a"); err.Error() != "invalid transaction" {