1
0
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:
Andy Grunwald
2016-06-03 23:25:18 +02:00
parent 7c3e481c65
commit 7ac3d14dbc
3 changed files with 42 additions and 43 deletions

View File

@ -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" {