mirror of
https://github.com/interviewstreet/go-jira.git
synced 2025-08-06 22:13:02 +02:00
go fmt, go doc and reuse of Project struct
This commit is contained in:
@ -10,15 +10,15 @@ import (
|
||||
func TestProjectGetAll(t *testing.T) {
|
||||
setup()
|
||||
defer teardown()
|
||||
testApiEdpoint := "/rest/api/2/project"
|
||||
testAPIEdpoint := "/rest/api/2/project"
|
||||
|
||||
raw, err := ioutil.ReadFile("./mocks/all_projects.json")
|
||||
if err != nil {
|
||||
t.Error(err.Error())
|
||||
}
|
||||
testMux.HandleFunc(testApiEdpoint, func(w http.ResponseWriter, r *http.Request) {
|
||||
testMux.HandleFunc(testAPIEdpoint, func(w http.ResponseWriter, r *http.Request) {
|
||||
testMethod(t, r, "GET")
|
||||
testRequestURL(t, r, testApiEdpoint)
|
||||
testRequestURL(t, r, testAPIEdpoint)
|
||||
fmt.Fprint(w, string(raw))
|
||||
})
|
||||
|
||||
@ -34,15 +34,15 @@ func TestProjectGetAll(t *testing.T) {
|
||||
func TestProjectGet(t *testing.T) {
|
||||
setup()
|
||||
defer teardown()
|
||||
testApiEdpoint := "/rest/api/2/project/12310505"
|
||||
testAPIEdpoint := "/rest/api/2/project/12310505"
|
||||
|
||||
raw, err := ioutil.ReadFile("./mocks/project.json")
|
||||
if err != nil {
|
||||
t.Error(err.Error())
|
||||
}
|
||||
testMux.HandleFunc(testApiEdpoint, func(w http.ResponseWriter, r *http.Request) {
|
||||
testMux.HandleFunc(testAPIEdpoint, func(w http.ResponseWriter, r *http.Request) {
|
||||
testMethod(t, r, "GET")
|
||||
testRequestURL(t, r, testApiEdpoint)
|
||||
testRequestURL(t, r, testAPIEdpoint)
|
||||
fmt.Fprint(w, string(raw))
|
||||
})
|
||||
|
||||
@ -58,17 +58,17 @@ func TestProjectGet(t *testing.T) {
|
||||
func TestProjectGet_NoProject(t *testing.T) {
|
||||
setup()
|
||||
defer teardown()
|
||||
testApiEdpoint := "/rest/api/2/project/99999999"
|
||||
testAPIEdpoint := "/rest/api/2/project/99999999"
|
||||
|
||||
testMux.HandleFunc(testApiEdpoint, func(w http.ResponseWriter, r *http.Request) {
|
||||
testMux.HandleFunc(testAPIEdpoint, func(w http.ResponseWriter, r *http.Request) {
|
||||
testMethod(t, r, "GET")
|
||||
testRequestURL(t, r, testApiEdpoint)
|
||||
testRequestURL(t, r, testAPIEdpoint)
|
||||
fmt.Fprint(w, nil)
|
||||
})
|
||||
|
||||
projects, resp, err := testClient.Project.Get("99999999")
|
||||
if projects != nil {
|
||||
t.Errorf("Expected nil. Got %s", projects)
|
||||
t.Errorf("Expected nil. Got %+v", projects)
|
||||
}
|
||||
|
||||
if resp.Status == "404" {
|
||||
|
Reference in New Issue
Block a user