diff --git a/main.go b/main.go index da522a3..7012af6 100644 --- a/main.go +++ b/main.go @@ -71,7 +71,7 @@ func main() { // Loop over all issues and check if they are correct / valid for _, issueFromUser := range issues { - err := checkIfIssue(issueFromUser, jiraClient) + err := checkIfIssueExists(issueFromUser, jiraClient) if err != nil { logger.Fatal(err) } @@ -111,9 +111,9 @@ func getIssuesOutOfMessage(projects []string, message string) []string { return issues } -// checkIfIssue checks if issue exists in the JIRA instance. +// checkIfIssueExists checks if issue exists in the JIRA instance. // If not an error will be returned. -func checkIfIssue(issue string, jiraClient *jira.Client) error { +func checkIfIssueExists(issue string, jiraClient *jira.Client) error { JIRAIssue, resp, err := jiraClient.Issue.Get(issue, nil) if c := resp.StatusCode; err != nil || (c < 200 || c > 299) { return fmt.Errorf("JIRA Request for issue %s returned %s (%d)", issue, resp.Status, resp.StatusCode) diff --git a/main_test.go b/main_test.go index 2666c3b..e629222 100644 --- a/main_test.go +++ b/main_test.go @@ -35,7 +35,7 @@ func teardown() { server.Close() } -func TestGetJIRAClient_IssueNotExists(t *testing.T) { +func TestGetJIRAClient_IssueDoesNotExist(t *testing.T) { setup() defer teardown() @@ -48,7 +48,7 @@ func TestGetJIRAClient_IssueNotExists(t *testing.T) { w.WriteHeader(http.StatusNotFound) }) - err = checkIfIssue("WEB-1234", c) + err = checkIfIssueExists("WEB-1234", c) if err == nil { t.Error("No error occuered. Expected a 404") }