-
-
Notifications
You must be signed in to change notification settings - Fork 473
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: Add unit test for priority api
- Loading branch information
Showing
3 changed files
with
75 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
[ | ||
{ | ||
"self": "https://issues.apache.org/jira/rest/api/2/priority/1", | ||
"statusColor": "#cc0000", | ||
"description": "Blocks development and/or testing work, production could not run", | ||
"iconUrl": "https://issues.apache.org/jira/images/icons/priorities/blocker.svg", | ||
"name": "Blocker", | ||
"id": "1" | ||
}, | ||
{ | ||
"self": "https://issues.apache.org/jira/rest/api/2/priority/2", | ||
"statusColor": "#ff0000", | ||
"description": "Crashes, loss of data, severe memory leak.", | ||
"iconUrl": "https://issues.apache.org/jira/images/icons/priorities/critical.svg", | ||
"name": "Critical", | ||
"id": "2" | ||
}, | ||
{ | ||
"self": "https://issues.apache.org/jira/rest/api/2/priority/3", | ||
"statusColor": "#009900", | ||
"description": "Major loss of function.", | ||
"iconUrl": "https://issues.apache.org/jira/images/icons/priorities/major.svg", | ||
"name": "Major", | ||
"id": "3" | ||
}, | ||
{ | ||
"self": "https://issues.apache.org/jira/rest/api/2/priority/4", | ||
"statusColor": "#006600", | ||
"description": "Minor loss of function, or other problem where easy workaround is present.", | ||
"iconUrl": "https://issues.apache.org/jira/images/icons/priorities/minor.svg", | ||
"name": "Minor", | ||
"id": "4" | ||
}, | ||
{ | ||
"self": "https://issues.apache.org/jira/rest/api/2/priority/5", | ||
"statusColor": "#003300", | ||
"description": "Cosmetic problem like misspelt words or misaligned text.", | ||
"iconUrl": "https://issues.apache.org/jira/images/icons/priorities/trivial.svg", | ||
"name": "Trivial", | ||
"id": "5" | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package jira | ||
|
||
import ( | ||
"fmt" | ||
"io/ioutil" | ||
"net/http" | ||
"testing" | ||
) | ||
|
||
func TestPriorityService_GetList(t *testing.T) { | ||
setup() | ||
defer teardown() | ||
testAPIEdpoint := "/rest/api/2/priority" | ||
|
||
raw, err := ioutil.ReadFile("./mocks/all_priorities.json") | ||
if err != nil { | ||
t.Error(err.Error()) | ||
} | ||
testMux.HandleFunc(testAPIEdpoint, func(w http.ResponseWriter, r *http.Request) { | ||
testMethod(t, r, "GET") | ||
testRequestURL(t, r, testAPIEdpoint) | ||
fmt.Fprint(w, string(raw)) | ||
}) | ||
|
||
priorities, _, err := testClient.Priority.GetList() | ||
if priorities == nil { | ||
t.Error("Expected priority list. Priority list is nil") | ||
} | ||
if err != nil { | ||
t.Errorf("Error given: %s", err) | ||
} | ||
} |