Increase unit test coverage of api/user.go (#4541)

* Add test to CheckUserDomain

* Add unit test to IsUsernameTaken
Этот коммит содержится в:
Raphaël Bournhonesque
2016-11-14 13:36:59 +01:00
коммит произвёл enahum
родитель ef080a0a10
Коммит 602f85d2ef
2 изменённых файлов: 47 добавлений и 0 удалений

Просмотреть файл

@@ -192,6 +192,7 @@ func createUser(c *Context, w http.ResponseWriter, r *http.Request) {
}
// Check that a user's email domain matches a list of space-delimited domains as a string.
func CheckUserDomain(user *model.User, domains string) bool {
if len(domains) == 0 {
return true
@@ -1957,6 +1958,7 @@ func updateUserNotify(c *Context, w http.ResponseWriter, r *http.Request) {
}
}
// Check if the username is already used by another user. Return false if the username is invalid.
func IsUsernameTaken(name string) bool {
if !model.IsValidUsername(name) {