mirror of
https://github.com/interviewstreet/go-jira.git
synced 2025-04-23 12:08:51 +02:00
feat: Implement issue link type PUT
This commit is contained in:
parent
75b9df8b01
commit
48a15c1044
@ -78,3 +78,20 @@ func (s *IssueLinkTypeService) Create(linkType *IssueLinkType) (*IssueLinkType,
|
|||||||
}
|
}
|
||||||
return linkType, resp, nil
|
return linkType, resp, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Update updates an issue link type. The issue is found by key.
|
||||||
|
//
|
||||||
|
// JIRA API docs: https://developer.atlassian.com/cloud/jira/platform/rest/v2/#api-rest-api-2-issueLinkType-issueLinkTypeId-put
|
||||||
|
func (s *IssueLinkTypeService) Update(linkType *IssueLinkType) (*IssueLinkType, *Response, error) {
|
||||||
|
apiEndpoint := fmt.Sprintf("rest/api/2/issueLinkType/%s", linkType.ID)
|
||||||
|
req, err := s.client.NewRequest("PUT", apiEndpoint, linkType)
|
||||||
|
if err != nil {
|
||||||
|
return nil, nil, err
|
||||||
|
}
|
||||||
|
resp, err := s.client.Do(req, nil)
|
||||||
|
if err != nil {
|
||||||
|
return nil, resp, NewJiraError(resp, err)
|
||||||
|
}
|
||||||
|
ret := *linkType
|
||||||
|
return &ret, resp, nil
|
||||||
|
}
|
||||||
|
@ -73,3 +73,27 @@ func TestIssueLinkTypeService_Create(t *testing.T) {
|
|||||||
t.Error("Expected linkType. LinkType is nil")
|
t.Error("Expected linkType. LinkType is nil")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestIssueLinkTypeService_Update(t *testing.T) {
|
||||||
|
setup()
|
||||||
|
defer teardown()
|
||||||
|
testMux.HandleFunc("/rest/api/2/issueLinkType/100", func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
testMethod(t, r, "PUT")
|
||||||
|
testRequestURL(t, r, "/rest/api/2/issueLinkType/100")
|
||||||
|
|
||||||
|
w.WriteHeader(http.StatusNoContent)
|
||||||
|
})
|
||||||
|
|
||||||
|
lt := &IssueLinkType{
|
||||||
|
ID: "100",
|
||||||
|
Name: "Problem/Incident",
|
||||||
|
Inward: "is caused by",
|
||||||
|
Outward: "causes",
|
||||||
|
}
|
||||||
|
|
||||||
|
if linkType, _, err := testClient.IssueLinkType.Update(lt); err != nil {
|
||||||
|
t.Errorf("Error given: %s", err)
|
||||||
|
} else if linkType == nil {
|
||||||
|
t.Error("Expected linkType. LinkType is nil")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user