diff options
Diffstat (limited to 'internal/validate')
-rw-r--r-- | internal/validate/formvalidation.go | 4 | ||||
-rw-r--r-- | internal/validate/formvalidation_test.go | 16 |
2 files changed, 10 insertions, 10 deletions
diff --git a/internal/validate/formvalidation.go b/internal/validate/formvalidation.go index 51efa320c..c109c26d8 100644 --- a/internal/validate/formvalidation.go +++ b/internal/validate/formvalidation.go @@ -46,9 +46,9 @@ const ( maximumListTitleLength = 200 ) -// NewPassword returns a helpful error if the given password +// Password returns a helpful error if the given password // is too short, too long, or not sufficiently strong. -func NewPassword(password string) error { +func Password(password string) error { // Ensure length is OK first. if pwLen := len(password); pwLen == 0 { return errors.New("no password provided / provided password was 0 bytes") diff --git a/internal/validate/formvalidation_test.go b/internal/validate/formvalidation_test.go index accd48ab6..534e5b849 100644 --- a/internal/validate/formvalidation_test.go +++ b/internal/validate/formvalidation_test.go @@ -43,42 +43,42 @@ func (suite *ValidationTestSuite) TestCheckPasswordStrength() { strongPassword := "3dX5@Zc%mV*W2MBNEy$@" var err error - err = validate.NewPassword(empty) + err = validate.Password(empty) if suite.Error(err) { suite.Equal(errors.New("no password provided / provided password was 0 bytes"), err) } - err = validate.NewPassword(terriblePassword) + err = validate.Password(terriblePassword) if suite.Error(err) { suite.Equal(errors.New("password is only 62% strength, try including more special characters, using uppercase letters, using numbers or using a longer password"), err) } - err = validate.NewPassword(weakPassword) + err = validate.Password(weakPassword) if suite.Error(err) { suite.Equal(errors.New("password is only 95% strength, try including more special characters, using numbers or using a longer password"), err) } - err = validate.NewPassword(shortPassword) + err = validate.Password(shortPassword) if suite.Error(err) { suite.Equal(errors.New("password is only 39% strength, try including more special characters or using a longer password"), err) } - err = validate.NewPassword(specialPassword) + err = validate.Password(specialPassword) if suite.Error(err) { suite.Equal(errors.New("password is only 53% strength, try including more special characters or using a longer password"), err) } - err = validate.NewPassword(longPassword) + err = validate.Password(longPassword) if suite.NoError(err) { suite.Equal(nil, err) } - err = validate.NewPassword(tooLong) + err = validate.Password(tooLong) if suite.Error(err) { suite.Equal(errors.New("password should be no more than 72 bytes, provided password was 571 bytes"), err) } - err = validate.NewPassword(strongPassword) + err = validate.Password(strongPassword) if suite.NoError(err) { suite.Equal(nil, err) } |