fix: return username format error on registration
This commit is contained in:
@@ -71,6 +71,18 @@ func TestResolveRegistrationAccount(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestRegistrationAccountErrorParams(t *testing.T) {
|
||||
params := registrationAccountErrorParams(errRegistrationUsernameInvalid)
|
||||
if params["what"] != "username" || params["reason"] != "USERNAME_INVALID_FORMAT" {
|
||||
t.Fatalf("got params=%v", params)
|
||||
}
|
||||
|
||||
params = registrationAccountErrorParams(types.ErrPolicy)
|
||||
if params["what"] != "account" || params["reason"] != "REGISTRATION_ACCOUNT_INVALID" {
|
||||
t.Fatalf("got fallback params=%v", params)
|
||||
}
|
||||
}
|
||||
|
||||
func TestRegistrationSecretMatchesSelectedAccount(t *testing.T) {
|
||||
if !registrationSecretMatches([]byte("alice:password:with-colon"), "alice") {
|
||||
t.Fatal("matching account was rejected")
|
||||
|
||||
Reference in New Issue
Block a user