1
0
mirror of https://github.com/interviewstreet/go-jira.git synced 2025-01-07 23:01:48 +02:00

fix the DeleteComment unit test

This commit is contained in:
Thiago Oliveira 2018-09-14 13:58:31 -07:00 committed by Andy Grunwald
parent 6e5d1122fb
commit 2990af0701

View File

@ -186,25 +186,14 @@ func TestIssueService_DeleteComment(t *testing.T) {
setup()
defer teardown()
testMux.HandleFunc("/rest/api/2/issue/10000/comment/10001", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "PUT")
testMethod(t, r, "DELETE")
testRequestURL(t, r, "/rest/api/2/issue/10000/comment/10001")
w.WriteHeader(http.StatusCreated)
fmt.Fprint(w, `{"self":"http://www.example.com/jira/rest/api/2/issue/10010/comment/10001","id":"10001","author":{"self":"http://www.example.com/jira/rest/api/2/user?username=fred","name":"fred","displayName":"Fred F. User","active":false},"body":"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque eget venenatis elit. Duis eu justo eget augue iaculis fermentum. Sed semper quam laoreet nisi egestas at posuere augue semper.","updateAuthor":{"self":"http://www.example.com/jira/rest/api/2/user?username=fred","name":"fred","displayName":"Fred F. User","active":false},"created":"2016-03-16T04:22:37.356+0000","updated":"2016-03-16T04:22:37.356+0000","visibility":{"type":"role","value":"Administrators"}}`)
w.WriteHeader(http.StatusNoContent)
fmt.Fprint(w, `{}`)
})
c := &Comment{
ID: "10001",
Body: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque eget venenatis elit. Duis eu justo eget augue iaculis fermentum. Sed semper quam laoreet nisi egestas at posuere augue semper.",
Visibility: CommentVisibility{
Type: "role",
Value: "Administrators",
},
}
comment, _, err := testClient.Issue.UpdateComment("10000", c)
if comment == nil {
t.Error("Expected Comment. Comment is nil")
}
err := testClient.Issue.DeleteComment("10000", "10001")
if err != nil {
t.Errorf("Error given: %s", err)
}