1
0

fix: check if usernames contain spaces when creating a new user

This commit is contained in:
kolaente
2023-03-12 15:02:34 +01:00
parent 1f13b5d7b4
commit 672fb35bcb
4 changed files with 69 additions and 19 deletions

View File

@ -133,6 +133,19 @@ func TestCreateUser(t *testing.T) {
})
assert.NoError(t, err)
})
t.Run("space in username", func(t *testing.T) {
db.LoadAndAssertFixtures(t)
s := db.NewSession()
defer s.Close()
_, err := CreateUser(s, &User{
Username: "user name",
Password: "12345",
Email: "user1@example.com",
})
assert.Error(t, err)
assert.True(t, IsErrUsernameMustNotContainSpaces(err))
})
}
func TestGetUser(t *testing.T) {