1
0
mirror of https://github.com/interviewstreet/go-jira.git synced 2025-06-23 00:07:40 +02:00

Added functions to provide optional parameters to the user search.

Signed-off-by: Eugene Dzhurinsky <jdevelop@gmail.com>
This commit is contained in:
Eugene Dzhurinsky
2018-07-02 22:11:58 -04:00
parent 0298784c46
commit ccc70f9aab
2 changed files with 81 additions and 2 deletions

View File

@ -124,3 +124,26 @@ func TestUserService_Find_Success(t *testing.T) {
t.Error("Expected user. User is nil")
}
}
func TestUserService_Find_SuccessParams(t *testing.T) {
setup()
defer teardown()
testMux.HandleFunc("/rest/api/2/user/search", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
testRequestURL(t, r, "/rest/api/2/user/search?username=fred@example.com&startAt=100&maxResults=1000")
fmt.Fprint(w, `[{"self":"http://www.example.com/jira/rest/api/2/user?username=fred","key":"fred",
"name":"fred","emailAddress":"fred@example.com","avatarUrls":{"48x48":"http://www.example.com/jira/secure/useravatar?size=large&ownerId=fred",
"24x24":"http://www.example.com/jira/secure/useravatar?size=small&ownerId=fred","16x16":"http://www.example.com/jira/secure/useravatar?size=xsmall&ownerId=fred",
"32x32":"http://www.example.com/jira/secure/useravatar?size=medium&ownerId=fred"},"displayName":"Fred F. User","active":true,"timeZone":"Australia/Sydney","groups":{"size":3,"items":[
{"name":"jira-user","self":"http://www.example.com/jira/rest/api/2/group?groupname=jira-user"},{"name":"jira-admin",
"self":"http://www.example.com/jira/rest/api/2/group?groupname=jira-admin"},{"name":"important","self":"http://www.example.com/jira/rest/api/2/group?groupname=important"
}]},"applicationRoles":{"size":1,"items":[]},"expand":"groups,applicationRoles"}]`)
})
if user, _, err := testClient.User.Find("fred@example.com", WithStartAt(100), WithMaxResults(1000)); err != nil {
t.Errorf("Error given: %s", err)
} else if user == nil {
t.Error("Expected user. User is nil")
}
}