aboutsummaryrefslogtreecommitdiffstats
path: root/models/user_test.go
diff options
context:
space:
mode:
author6543 <24977596+6543@users.noreply.github.com>2019-11-10 09:07:21 +0100
committerLunny Xiao <xiaolunwen@gmail.com>2019-11-10 16:07:21 +0800
commit31416a5f4e70d4972c351cde170b59d13fcbb77f (patch)
tree9ab42512fa2989932b6ef69d91606441bd8f9a7d /models/user_test.go
parentdaab2451676b1a3a5312af0e2a443e6017113702 (diff)
downloadgitea-31416a5f4e70d4972c351cde170b59d13fcbb77f.tar.gz
gitea-31416a5f4e70d4972c351cde170b59d13fcbb77f.zip
Fix API Bug (fail on empty assignees) (#8873)
* keep sure if assigneeIDs == nil -> do nothing * fix #8872 * Revert "keep sure if assigneeIDs == nil -> do nothing" -> go handle it itself preaty well This reverts commit e72d94129c4666d5151f6131cb2f8c1de127d9d0. * clarity comparson Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com> * simplify * Update models/issue_assignees.go Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com> * Update issue_assignees.go * simplify more * add --if oneAssignee != ""-- again * Update models/issue_assignees.go Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com> * CI.restart() * Update issue_assignees.go * add Test for GetUserIDsByNames * add Test for MakeIDsFromAPIAssigneesToAdd * fix test
Diffstat (limited to 'models/user_test.go')
-rw-r--r--models/user_test.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/models/user_test.go b/models/user_test.go
index bcb955817c..f3952422af 100644
--- a/models/user_test.go
+++ b/models/user_test.go
@@ -373,3 +373,16 @@ func TestCreateUser_Issue5882(t *testing.T) {
assert.NoError(t, DeleteUser(v.user))
}
}
+
+func TestGetUserIDsByNames(t *testing.T) {
+
+ //ignore non existing
+ IDs, err := GetUserIDsByNames([]string{"user1", "user2", "none_existing_user"}, true)
+ assert.NoError(t, err)
+ assert.Equal(t, []int64{1, 2}, IDs)
+
+ //ignore non existing
+ IDs, err = GetUserIDsByNames([]string{"user1", "do_not_exist"}, false)
+ assert.Error(t, err)
+ assert.Equal(t, []int64(nil), IDs)
+}