forked from andygrunwald/go-jira
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: removing the use of username field in searching for users (andyg…
- Loading branch information
1 parent
146229d
commit f50cb07
Showing
4 changed files
with
43 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1598,15 +1598,14 @@ func TestIssueService_DeprecatedGetWatchers(t *testing.T) { | |
testMethod(t, r, "GET") | ||
testRequestURL(t, r, "/rest/api/2/issue/10002/watchers") | ||
|
||
fmt.Fprint(w, `{"self":"http://www.example.com/jira/rest/api/2/issue/EX-1/watchers","isWatching":false,"watchCount":1,"watchers":[{"self":"http://www.example.com/jira/rest/api/2/user?username=fred","name":"fred","displayName":"Fred F. User","active":false}]}`) | ||
fmt.Fprint(w, `{"self":"http://www.example.com/jira/rest/api/2/issue/EX-1/watchers","isWatching":false,"watchCount":1,"watchers":[{"self":"http://www.example.com/jira/rest/api/2/user?accountId=000000000000000000000000", "accountId": "000000000000000000000000", "displayName":"Fred F. User","active":false}]}`) | ||
}) | ||
|
||
testMux.HandleFunc("/rest/api/2/user", func(w http.ResponseWriter, r *http.Request) { | ||
testMethod(t, r, "GET") | ||
testRequestURL(t, r, "/rest/api/2/user?username=fred") | ||
testRequestURL(t, r, "/rest/api/2/user?accountId=000000000000000000000000") | ||
|
||
fmt.Fprint(w, `{"self":"http://www.example.com/jira/rest/api/2/user?username=fred","key":"fred", | ||
"name":"fred","emailAddress":"[email protected]","avatarUrls":{"48x48":"http://www.example.com/jira/secure/useravatar?size=large&ownerId=fred", | ||
fmt.Fprint(w, `{"self":"http://www.example.com/jira/rest/api/2/user?accountId=000000000000000000000000", "accountId": "000000000000000000000000", "key": "", "name": "", "emailAddress":"[email protected]","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", | ||
|
@@ -1627,8 +1626,8 @@ func TestIssueService_DeprecatedGetWatchers(t *testing.T) { | |
t.Errorf("Expected 1 watcher, got: %d", len(*watchers)) | ||
return | ||
} | ||
if (*watchers)[0].Name != "fred" { | ||
t.Error("Expected watcher name fred") | ||
if (*watchers)[0].AccountID != "000000000000000000000000" { | ||
t.Error("Expected accountId 000000000000000000000000") | ||
} | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,7 @@ func TestUserService_Get_Success(t *testing.T) { | |
defer teardown() | ||
testMux.HandleFunc("/rest/api/2/user", func(w http.ResponseWriter, r *http.Request) { | ||
testMethod(t, r, "GET") | ||
testRequestURL(t, r, "/rest/api/2/user?username=fred") | ||
testRequestURL(t, r, "/rest/api/2/user?accountId=000000000000000000000000") | ||
|
||
fmt.Fprint(w, `{"self":"http://www.example.com/jira/rest/api/2/user?username=fred","key":"fred", | ||
"name":"fred","emailAddress":"[email protected]","avatarUrls":{"48x48":"http://www.example.com/jira/secure/useravatar?size=large&ownerId=fred", | ||
|
@@ -22,7 +22,7 @@ func TestUserService_Get_Success(t *testing.T) { | |
}]},"applicationRoles":{"size":1,"items":[]},"expand":"groups,applicationRoles"}`) | ||
}) | ||
|
||
if user, _, err := testClient.User.Get("fred"); err != nil { | ||
if user, _, err := testClient.User.Get("000000000000000000000000"); err != nil { | ||
t.Errorf("Error given: %s", err) | ||
} else if user == nil { | ||
t.Error("Expected user. User is nil") | ||
|
@@ -84,12 +84,12 @@ func TestUserService_Delete(t *testing.T) { | |
defer teardown() | ||
testMux.HandleFunc("/rest/api/2/user", func(w http.ResponseWriter, r *http.Request) { | ||
testMethod(t, r, "DELETE") | ||
testRequestURL(t, r, "/rest/api/2/user?username=fred") | ||
testRequestURL(t, r, "/rest/api/2/user?accountId=000000000000000000000000") | ||
|
||
w.WriteHeader(http.StatusNoContent) | ||
}) | ||
|
||
resp, err := testClient.User.Delete("fred") | ||
resp, err := testClient.User.Delete("000000000000000000000000") | ||
if err != nil { | ||
t.Errorf("Error given: %s", err) | ||
} | ||
|
@@ -104,13 +104,13 @@ func TestUserService_GetGroups(t *testing.T) { | |
defer teardown() | ||
testMux.HandleFunc("/rest/api/2/user/groups", func(w http.ResponseWriter, r *http.Request) { | ||
testMethod(t, r, "GET") | ||
testRequestURL(t, r, "/rest/api/2/user/groups?username=fred") | ||
testRequestURL(t, r, "/rest/api/2/user/groups?accountId=000000000000000000000000") | ||
|
||
w.WriteHeader(http.StatusCreated) | ||
fmt.Fprint(w, `[{"name":"jira-software-users","self":"http://www.example.com/jira/rest/api/2/user?username=fred"}]`) | ||
fmt.Fprint(w, `[{"name":"jira-software-users","self":"http://www.example.com/jira/rest/api/2/user?accountId=000000000000000000000000"}]`) | ||
}) | ||
|
||
if groups, _, err := testClient.User.GetGroups("fred"); err != nil { | ||
if groups, _, err := testClient.User.GetGroups("000000000000000000000000"); err != nil { | ||
t.Errorf("Error given: %s", err) | ||
} else if groups == nil { | ||
t.Error("Expected user groups. []UserGroup is nil") | ||
|
@@ -125,7 +125,7 @@ func TestUserService_GetSelf(t *testing.T) { | |
testRequestURL(t, r, "/rest/api/2/myself") | ||
|
||
w.WriteHeader(http.StatusCreated) | ||
fmt.Fprint(w, `{"self":"http://www.example.com/jira/rest/api/2/user?username=fred","key":"fred", | ||
fmt.Fprint(w, `{"self":"http://www.example.com/jira/rest/api/2/user?accountId=000000000000000000000000","key":"fred", | ||
"name":"fred","emailAddress":"[email protected]","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":[ | ||
|
@@ -150,9 +150,9 @@ func TestUserService_Find_Success(t *testing.T) { | |
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[email protected]") | ||
testRequestURL(t, r, "/rest/api/2/user/search?query[email protected]") | ||
|
||
fmt.Fprint(w, `[{"self":"http://www.example.com/jira/rest/api/2/user?username=fred","key":"fred", | ||
fmt.Fprint(w, `[{"self":"http://www.example.com/jira/rest/api/2/user?accountId=000000000000000000000000","key":"fred", | ||
"name":"fred","emailAddress":"[email protected]","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":[ | ||
|
@@ -173,9 +173,9 @@ func TestUserService_Find_SuccessParams(t *testing.T) { | |
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[email protected]&startAt=100&maxResults=1000") | ||
testRequestURL(t, r, "/rest/api/2/user/search?query[email protected]&startAt=100&maxResults=1000") | ||
|
||
fmt.Fprint(w, `[{"self":"http://www.example.com/jira/rest/api/2/user?username=fred","key":"fred", | ||
fmt.Fprint(w, `[{"self":"http://www.example.com/jira/rest/api/2/user?query=fred","key":"fred", | ||
"name":"fred","emailAddress":"[email protected]","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":[ | ||
|