aboutsummaryrefslogtreecommitdiffstats
path: root/signer/core/validation_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'signer/core/validation_test.go')
-rw-r--r--signer/core/validation_test.go26
1 files changed, 26 insertions, 0 deletions
diff --git a/signer/core/validation_test.go b/signer/core/validation_test.go
index 2b33a8630..155b25e92 100644
--- a/signer/core/validation_test.go
+++ b/signer/core/validation_test.go
@@ -137,3 +137,29 @@ func TestValidator(t *testing.T) {
}
}
}
+
+func TestPasswordValidation(t *testing.T) {
+ testcases := []struct {
+ pw string
+ shouldFail bool
+ }{
+ {"test", true},
+ {"testtest\xbd\xb2\x3d\xbc\x20\xe2\x8c\x98", true},
+ {"placeOfInterest⌘", true},
+ {"password\nwith\nlinebreak", true},
+ {"password\twith\vtabs", true},
+ // Ok passwords
+ {"password WhichIsOk", false},
+ {"passwordOk!@#$%^&*()", false},
+ {"12301203123012301230123012", false},
+ }
+ for _, test := range testcases {
+ err := ValidatePasswordFormat(test.pw)
+ if err == nil && test.shouldFail {
+ t.Errorf("password '%v' should fail validation", test.pw)
+ } else if err != nil && !test.shouldFail {
+
+ t.Errorf("password '%v' shound not fail validation, but did: %v", test.pw, err)
+ }
+ }
+}