diff options
Diffstat (limited to 'pkg/navitia_api_client')
-rw-r--r-- | pkg/navitia_api_client/client_test.go | 6 | ||||
-rw-r--r-- | pkg/navitia_api_client/departures_test.go | 6 |
2 files changed, 6 insertions, 6 deletions
diff --git a/pkg/navitia_api_client/client_test.go b/pkg/navitia_api_client/client_test.go index 332b222..df23790 100644 --- a/pkg/navitia_api_client/client_test.go +++ b/pkg/navitia_api_client/client_test.go @@ -9,7 +9,7 @@ import ( ) // package utilities -func NewTestClient(ts *httptest.Server) *Client { +func newTestClient(ts *httptest.Server) *Client { return &Client{ baseURL: fmt.Sprintf(ts.URL), httpClient: ts.Client(), @@ -17,7 +17,7 @@ func NewTestClient(ts *httptest.Server) *Client { } } -func NewTestClientFromFilename(t *testing.T, filename string) (*Client, *httptest.Server) { +func newTestClientFromFilename(t *testing.T, filename string) (*Client, *httptest.Server) { ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { page, err := ioutil.ReadFile(filename) if err != nil { @@ -25,7 +25,7 @@ func NewTestClientFromFilename(t *testing.T, filename string) (*Client, *httptes } w.Write(page) })) - return NewTestClient(ts), ts + return newTestClient(ts), ts } // tests diff --git a/pkg/navitia_api_client/departures_test.go b/pkg/navitia_api_client/departures_test.go index a1658d2..14ffb96 100644 --- a/pkg/navitia_api_client/departures_test.go +++ b/pkg/navitia_api_client/departures_test.go @@ -20,7 +20,7 @@ func TestGetDepartures(t *testing.T) { t.Fatalf("unreachable server should raise an error") } // invalid json - client, ts := NewTestClientFromFilename(t, "test_data/invalid.json") + client, ts := newTestClientFromFilename(t, "test_data/invalid.json") defer ts.Close() _, err = client.GetDepartures() if err == nil { @@ -30,13 +30,13 @@ func TestGetDepartures(t *testing.T) { ts = httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { w.WriteHeader(http.StatusNotFound) })) - client = NewTestClient(ts) + client = newTestClient(ts) _, err = client.GetDepartures() if err == nil { t.Fatalf("404 should raise an error") } // normal working request - client, ts = NewTestClientFromFilename(t, "test_data/normal-crepieux.json") + client, ts = newTestClientFromFilename(t, "test_data/normal-crepieux.json") defer ts.Close() departures, err := client.GetDepartures() if err != nil { |