-
-
Notifications
You must be signed in to change notification settings - Fork 471
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #685 from benjaminguttmann-avtq/662-change-depreca…
…ted-api-call Switch to v2 attachment/content
- Loading branch information
Showing
2 changed files
with
8 additions
and
8 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 |
---|---|---|
|
@@ -401,9 +401,9 @@ func TestIssueService_DownloadAttachment(t *testing.T) { | |
|
||
setup() | ||
defer teardown() | ||
testMux.HandleFunc("/secure/attachment/", func(w http.ResponseWriter, r *http.Request) { | ||
testMux.HandleFunc("/rest/api/2/attachment/content/", func(w http.ResponseWriter, r *http.Request) { | ||
testMethod(t, r, http.MethodGet) | ||
testRequestURL(t, r, "/secure/attachment/10000/") | ||
testRequestURL(t, r, "/rest/api/2/attachment/content/10000/") | ||
|
||
w.WriteHeader(http.StatusOK) | ||
w.Write([]byte(testAttachment)) | ||
|
@@ -436,9 +436,9 @@ func TestIssueService_DownloadAttachment_BadStatus(t *testing.T) { | |
|
||
setup() | ||
defer teardown() | ||
testMux.HandleFunc("/secure/attachment/", func(w http.ResponseWriter, r *http.Request) { | ||
testMux.HandleFunc("/rest/api/2/attachment/content/", func(w http.ResponseWriter, r *http.Request) { | ||
testMethod(t, r, http.MethodGet) | ||
testRequestURL(t, r, "/secure/attachment/10000/") | ||
testRequestURL(t, r, "/rest/api/2/attachment/content/10000/") | ||
|
||
w.WriteHeader(http.StatusForbidden) | ||
}) | ||
|
@@ -487,7 +487,7 @@ func TestIssueService_PostAttachment(t *testing.T) { | |
} | ||
} | ||
w.WriteHeader(status) | ||
fmt.Fprint(w, `[{"self":"http://jira/jira/rest/api/2/attachment/228924","id":"228924","filename":"example.jpg","author":{"self":"http://jira/jira/rest/api/2/user?username=test","name":"test","emailAddress":"[email protected]","avatarUrls":{"16x16":"http://jira/jira/secure/useravatar?size=small&avatarId=10082","48x48":"http://jira/jira/secure/useravatar?avatarId=10082"},"displayName":"Tester","active":true},"created":"2016-05-24T00:25:17.000-0700","size":32280,"mimeType":"image/jpeg","content":"http://jira/jira/secure/attachment/228924/example.jpg","thumbnail":"http://jira/jira/secure/thumbnail/228924/_thumb_228924.png"}]`) | ||
fmt.Fprint(w, `[{"self":"http://jira/jira/rest/api/2/attachment/228924","id":"228924","filename":"example.jpg","author":{"self":"http://jira/jira/rest/api/2/user?username=test","name":"test","emailAddress":"[email protected]","avatarUrls":{"16x16":"http://jira/jira/secure/useravatar?size=small&avatarId=10082","48x48":"http://jira/jira/secure/useravatar?avatarId=10082"},"displayName":"Tester","active":true},"created":"2016-05-24T00:25:17.000-0700","size":32280,"mimeType":"image/jpeg","content":"http://jira/jira/rest/api/2/attachment/content/228924/example.jpg","thumbnail":"http://jira/jira/secure/thumbnail/228924/_thumb_228924.png"}]`) | ||
}) | ||
|
||
reader := strings.NewReader(testAttachment) | ||
|
@@ -535,7 +535,7 @@ func TestIssueService_PostAttachment_NoFilename(t *testing.T) { | |
testMethod(t, r, http.MethodPost) | ||
testRequestURL(t, r, "/rest/api/2/issue/10000/attachments") | ||
w.WriteHeader(http.StatusOK) | ||
fmt.Fprint(w, `[{"self":"http://jira/jira/rest/api/2/attachment/228924","id":"228924","filename":"example.jpg","author":{"self":"http://jira/jira/rest/api/2/user?username=test","name":"test","emailAddress":"[email protected]","avatarUrls":{"16x16":"http://jira/jira/secure/useravatar?size=small&avatarId=10082","48x48":"http://jira/jira/secure/useravatar?avatarId=10082"},"displayName":"Tester","active":true},"created":"2016-05-24T00:25:17.000-0700","size":32280,"mimeType":"image/jpeg","content":"http://jira/jira/secure/attachment/228924/example.jpg","thumbnail":"http://jira/jira/secure/thumbnail/228924/_thumb_228924.png"}]`) | ||
fmt.Fprint(w, `[{"self":"http://jira/jira/rest/api/2/attachment/228924","id":"228924","filename":"example.jpg","author":{"self":"http://jira/jira/rest/api/2/user?username=test","name":"test","emailAddress":"[email protected]","avatarUrls":{"16x16":"http://jira/jira/secure/useravatar?size=small&avatarId=10082","48x48":"http://jira/jira/secure/useravatar?avatarId=10082"},"displayName":"Tester","active":true},"created":"2016-05-24T00:25:17.000-0700","size":32280,"mimeType":"image/jpeg","content":"http://jira/jira/rest/api/2/attachment/content/228924/example.jpg","thumbnail":"http://jira/jira/secure/thumbnail/228924/_thumb_228924.png"}]`) | ||
}) | ||
reader := strings.NewReader(testAttachment) | ||
|
||
|
@@ -553,7 +553,7 @@ func TestIssueService_PostAttachment_NoAttachment(t *testing.T) { | |
testMethod(t, r, http.MethodPost) | ||
testRequestURL(t, r, "/rest/api/2/issue/10000/attachments") | ||
w.WriteHeader(http.StatusOK) | ||
fmt.Fprint(w, `[{"self":"http://jira/jira/rest/api/2/attachment/228924","id":"228924","filename":"example.jpg","author":{"self":"http://jira/jira/rest/api/2/user?username=test","name":"test","emailAddress":"[email protected]","avatarUrls":{"16x16":"http://jira/jira/secure/useravatar?size=small&avatarId=10082","48x48":"http://jira/jira/secure/useravatar?avatarId=10082"},"displayName":"Tester","active":true},"created":"2016-05-24T00:25:17.000-0700","size":32280,"mimeType":"image/jpeg","content":"http://jira/jira/secure/attachment/228924/example.jpg","thumbnail":"http://jira/jira/secure/thumbnail/228924/_thumb_228924.png"}]`) | ||
fmt.Fprint(w, `[{"self":"http://jira/jira/rest/api/2/attachment/228924","id":"228924","filename":"example.jpg","author":{"self":"http://jira/jira/rest/api/2/user?username=test","name":"test","emailAddress":"[email protected]","avatarUrls":{"16x16":"http://jira/jira/secure/useravatar?size=small&avatarId=10082","48x48":"http://jira/jira/secure/useravatar?avatarId=10082"},"displayName":"Tester","active":true},"created":"2016-05-24T00:25:17.000-0700","size":32280,"mimeType":"image/jpeg","content":"http://jira/jira/rest/api/2/attachment/content/228924/example.jpg","thumbnail":"http://jira/jira/secure/thumbnail/228924/_thumb_228924.png"}]`) | ||
}) | ||
|
||
_, _, err := testClient.Issue.PostAttachment(context.Background(), "10000", nil, "attachment") | ||
|