From 602f85d2efe6b9127c0cd79618757c3ff2b0ef5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Bournhonesque?= Date: Mon, 14 Nov 2016 13:36:59 +0100 Subject: Increase unit test coverage of api/user.go (#4541) * Add test to CheckUserDomain * Add unit test to IsUsernameTaken --- api/user.go | 2 ++ 1 file changed, 2 insertions(+) (limited to 'api/user.go') diff --git a/api/user.go b/api/user.go index 60c2673d9..93a07134d 100644 --- a/api/user.go +++ b/api/user.go @@ -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) { -- cgit v1.2.3-1-g7c22