aboutsummaryrefslogtreecommitdiff
path: root/navitia_api_client/client_test.go
diff options
context:
space:
mode:
authorJulien Dessaux2021-04-05 17:52:31 +0200
committerJulien Dessaux2021-04-05 17:52:31 +0200
commit1ffc9c42054e208a01d3e70e6b6f3e1781e798f8 (patch)
tree721f202dcf46fb5e9c181013237e4da9d27f796a /navitia_api_client/client_test.go
parentReworked error handling for better and simpler tests (diff)
downloadtrains-1ffc9c42054e208a01d3e70e6b6f3e1781e798f8.tar.gz
trains-1ffc9c42054e208a01d3e70e6b6f3e1781e798f8.tar.bz2
trains-1ffc9c42054e208a01d3e70e6b6f3e1781e798f8.zip
Moved code around to conform best practices
Diffstat (limited to 'navitia_api_client/client_test.go')
-rw-r--r--navitia_api_client/client_test.go38
1 files changed, 0 insertions, 38 deletions
diff --git a/navitia_api_client/client_test.go b/navitia_api_client/client_test.go
deleted file mode 100644
index 332b222..0000000
--- a/navitia_api_client/client_test.go
+++ /dev/null
@@ -1,38 +0,0 @@
-package navitia_api_client
-
-import (
- "fmt"
- "io/ioutil"
- "net/http"
- "net/http/httptest"
- "testing"
-)
-
-// package utilities
-func NewTestClient(ts *httptest.Server) *Client {
- return &Client{
- baseURL: fmt.Sprintf(ts.URL),
- httpClient: ts.Client(),
- cache: make(map[string]cachedResult),
- }
-}
-
-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 {
- t.Fatalf("Could not open test file : %s", err)
- }
- w.Write(page)
- }))
- return NewTestClient(ts), ts
-}
-
-// tests
-func TestNewClient(t *testing.T) {
- client := NewClient("test")
- want := "https://test@api.sncf.com/v1"
- if client.baseURL != want {
- t.Fatal("Invalid new client")
- }
-}