diff options
author | Julien Dessaux | 2021-03-29 00:07:03 +0200 |
---|---|---|
committer | Julien Dessaux | 2021-03-29 00:07:03 +0200 |
commit | dbb4167a49343defa8be01921c3943d7eeb8b9dd (patch) | |
tree | b5eb69c6d4edc46bf6dc851493c6fb957bcecfa2 /api/client_test.go | |
parent | Moved api test files into their own folder (diff) | |
download | trains-dbb4167a49343defa8be01921c3943d7eeb8b9dd.tar.gz trains-dbb4167a49343defa8be01921c3943d7eeb8b9dd.tar.bz2 trains-dbb4167a49343defa8be01921c3943d7eeb8b9dd.zip |
Renamed the api folder to something more specific
Diffstat (limited to 'api/client_test.go')
-rw-r--r-- | api/client_test.go | 37 |
1 files changed, 0 insertions, 37 deletions
diff --git a/api/client_test.go b/api/client_test.go deleted file mode 100644 index c6146d4..0000000 --- a/api/client_test.go +++ /dev/null @@ -1,37 +0,0 @@ -package api - -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(), - } -} - -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") - } -} |