mirror of
https://github.com/interviewstreet/go-jira.git
synced 2025-11-29 22:28:34 +02:00
feat: added DeleteAttachment
This commit is contained in:
committed by
Wes McNamee
parent
84a0f1e46f
commit
e93c0e1785
@@ -539,6 +539,36 @@ func TestIssueService_PostAttachment_NoAttachment(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestIssueService_DeleteAttachment(t *testing.T) {
|
||||
setup()
|
||||
defer teardown()
|
||||
testMux.HandleFunc("/rest/api/2/attachment/10054", func(w http.ResponseWriter, r *http.Request) {
|
||||
testMethod(t, r, "DELETE")
|
||||
testRequestURL(t, r, "/rest/api/2/attachment/10054")
|
||||
|
||||
w.WriteHeader(http.StatusNoContent)
|
||||
fmt.Fprint(w, `{}`)
|
||||
})
|
||||
|
||||
resp, err := testClient.Issue.DeleteAttachment("10054")
|
||||
if resp.StatusCode != 204 {
|
||||
t.Error("Expected attachment not deleted.")
|
||||
if resp.StatusCode == 403 {
|
||||
t.Error("User not permitted to delete attachment")
|
||||
}
|
||||
if resp.StatusCode == 404 {
|
||||
t.Error("Attachment not found")
|
||||
}
|
||||
} else {
|
||||
t.Log("Attachment deleted")
|
||||
}
|
||||
if err != nil {
|
||||
t.Errorf("Error given: %s", err)
|
||||
} else {
|
||||
t.Log("No error")
|
||||
}
|
||||
}
|
||||
|
||||
func TestIssueService_Search(t *testing.T) {
|
||||
setup()
|
||||
defer teardown()
|
||||
|
||||
Reference in New Issue
Block a user