summaryrefslogtreecommitdiffstats
path: root/models/user_test.go
diff options
context:
space:
mode:
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)
+}