mirror of
https://github.com/interviewstreet/go-jira.git
synced 2025-03-17 20:47:57 +02:00
feat: Implement issue link type DELETE
This commit is contained in:
parent
48a15c1044
commit
e37cc6c689
@ -95,3 +95,17 @@ func (s *IssueLinkTypeService) Update(linkType *IssueLinkType) (*IssueLinkType,
|
||||
ret := *linkType
|
||||
return &ret, resp, nil
|
||||
}
|
||||
|
||||
// Delete deletes an issue link type based on provided ID.
|
||||
//
|
||||
// JIRA API docs: https://developer.atlassian.com/cloud/jira/platform/rest/v2/#api-rest-api-2-issueLinkType-issueLinkTypeId-delete
|
||||
func (s *IssueLinkTypeService) Delete(ID string) (*Response, error) {
|
||||
apiEndpoint := fmt.Sprintf("rest/api/2/issueLinkType/%s", ID)
|
||||
req, err := s.client.NewRequest("DELETE", apiEndpoint, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
resp, err := s.client.Do(req, nil)
|
||||
return resp, err
|
||||
}
|
||||
|
@ -97,3 +97,22 @@ func TestIssueLinkTypeService_Update(t *testing.T) {
|
||||
t.Error("Expected linkType. LinkType is nil")
|
||||
}
|
||||
}
|
||||
|
||||
func TestIssueLinkTypeService_Delete(t *testing.T) {
|
||||
setup()
|
||||
defer teardown()
|
||||
testMux.HandleFunc("/rest/api/2/issueLinkType/100", func(w http.ResponseWriter, r *http.Request) {
|
||||
testMethod(t, r, "DELETE")
|
||||
testRequestURL(t, r, "/rest/api/2/issueLinkType/100")
|
||||
|
||||
w.WriteHeader(http.StatusNoContent)
|
||||
})
|
||||
|
||||
resp, err := testClient.IssueLinkType.Delete("100")
|
||||
if resp.StatusCode != http.StatusNoContent {
|
||||
t.Error("Expected issue not deleted.")
|
||||
}
|
||||
if err != nil {
|
||||
t.Errorf("Error given: %s", err)
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user