1
0
mirror of https://github.com/interviewstreet/go-jira.git synced 2024-11-30 08:47:11 +02:00
go-jira/field_test.go

33 lines
641 B
Go
Raw Permalink Normal View History

2018-06-13 03:27:42 +02:00
package jira
import (
"fmt"
"io/ioutil"
"net/http"
"testing"
)
func TestFieldService_GetList(t *testing.T) {
setup()
defer teardown()
testAPIEdpoint := "/rest/api/2/field"
raw, err := ioutil.ReadFile("./mocks/all_fields.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))
})
fields, _, err := testClient.Field.GetList()
if fields == nil {
2018-06-25 17:52:57 +02:00
t.Error("Expected field list. Field list is nil")
2018-06-13 03:27:42 +02:00
}
if err != nil {
t.Errorf("Error given: %s", err)
}
}