mirror of
https://github.com/interviewstreet/go-jira.git
synced 2025-01-07 23:01:48 +02:00
add unittest for UpdateIssue
This commit is contained in:
parent
4a50cc4eb6
commit
e88af2595a
2
issue.go
2
issue.go
@ -614,12 +614,10 @@ func (s *IssueService) Update(issue *Issue) (*Issue, *Response, error) {
|
||||
func (s *IssueService) UpdateIssue(jiraId string, data map[string]interface{}) (*Response, error) {
|
||||
apiEndpoint := fmt.Sprintf("rest/api/2/issue/%v", jiraId)
|
||||
req, err := s.client.NewRequest("PUT", apiEndpoint, data)
|
||||
fmt.Println(apiEndpoint, req, err)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
resp, err := s.client.Do(req, nil)
|
||||
fmt.Println(resp, err)
|
||||
if err != nil {
|
||||
return resp, err
|
||||
}
|
||||
|
@ -103,6 +103,29 @@ func TestIssueService_Update(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestIssueService_UpdateIssue(t *testing.T) {
|
||||
setup()
|
||||
defer teardown()
|
||||
testMux.HandleFunc("/rest/api/2/issue/PROJ-9001", func(w http.ResponseWriter, r *http.Request) {
|
||||
testMethod(t, r, "PUT")
|
||||
testRequestURL(t, r, "/rest/api/2/issue/PROJ-9001")
|
||||
|
||||
w.WriteHeader(http.StatusNoContent)
|
||||
})
|
||||
jId := "PROJ-9001"
|
||||
i := make(map[string]interface{})
|
||||
fields := make(map[string]interface{})
|
||||
i["fields"] = fields
|
||||
resp, err := testClient.Issue.UpdateIssue(jId, i)
|
||||
if resp == nil {
|
||||
t.Error("Expected resp. resp is nil")
|
||||
}
|
||||
if err != nil {
|
||||
t.Errorf("Error given: %s", err)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func TestIssueService_AddComment(t *testing.T) {
|
||||
setup()
|
||||
defer teardown()
|
||||
|
Loading…
Reference in New Issue
Block a user