mirror of
https://github.com/interviewstreet/go-jira.git
synced 2025-08-08 22:16:34 +02:00
4
issue.go
4
issue.go
@ -588,11 +588,11 @@ func (s *IssueService) Create(issue *Issue) (*Issue, *Response, error) {
|
|||||||
return responseIssue, resp, nil
|
return responseIssue, resp, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update updates an issue from a JSON representation.
|
// Update updates an issue from a JSON representation. The issue is found by key.
|
||||||
//
|
//
|
||||||
// JIRA API docs: https://docs.atlassian.com/jira/REST/cloud/#api/2/issue-editIssue
|
// JIRA API docs: https://docs.atlassian.com/jira/REST/cloud/#api/2/issue-editIssue
|
||||||
func (s *IssueService) Update(issue *Issue) (*Issue, *Response, error) {
|
func (s *IssueService) Update(issue *Issue) (*Issue, *Response, error) {
|
||||||
apiEndpoint := fmt.Sprintf("rest/api/2/issue/%v", issue.ID)
|
apiEndpoint := fmt.Sprintf("rest/api/2/issue/%v", issue.Key)
|
||||||
req, err := s.client.NewRequest("PUT", apiEndpoint, issue)
|
req, err := s.client.NewRequest("PUT", apiEndpoint, issue)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
|
@ -81,15 +81,15 @@ func TestIssueService_Create(t *testing.T) {
|
|||||||
func TestIssueService_Update(t *testing.T) {
|
func TestIssueService_Update(t *testing.T) {
|
||||||
setup()
|
setup()
|
||||||
defer teardown()
|
defer teardown()
|
||||||
testMux.HandleFunc("/rest/api/2/issue/10002", func(w http.ResponseWriter, r *http.Request) {
|
testMux.HandleFunc("/rest/api/2/issue/PROJ-9001", func(w http.ResponseWriter, r *http.Request) {
|
||||||
testMethod(t, r, "PUT")
|
testMethod(t, r, "PUT")
|
||||||
testRequestURL(t, r, "/rest/api/2/issue/10002")
|
testRequestURL(t, r, "/rest/api/2/issue/PROJ-9001")
|
||||||
|
|
||||||
w.WriteHeader(http.StatusNoContent)
|
w.WriteHeader(http.StatusNoContent)
|
||||||
})
|
})
|
||||||
|
|
||||||
i := &Issue{
|
i := &Issue{
|
||||||
ID: "10002",
|
Key: "PROJ-9001",
|
||||||
Fields: &IssueFields{
|
Fields: &IssueFields{
|
||||||
Description: "example bug report",
|
Description: "example bug report",
|
||||||
},
|
},
|
||||||
|
Reference in New Issue
Block a user