From 2990af070102eed5809851265afe958f0acc4810 Mon Sep 17 00:00:00 2001 From: Thiago Oliveira Date: Fri, 14 Sep 2018 13:58:31 -0700 Subject: [PATCH] fix the DeleteComment unit test --- issue_test.go | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/issue_test.go b/issue_test.go index 2737673..a983baa 100644 --- a/issue_test.go +++ b/issue_test.go @@ -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) }