diff options
author | Julien Dessaux | 2021-09-10 17:31:59 +0200 |
---|---|---|
committer | Julien Dessaux | 2021-09-10 17:32:22 +0200 |
commit | 7ae1c766447711ee568566ba52a23f99cc92a49f (patch) | |
tree | c8288a3b6568192e15c4fe0f4f885e37505eabed /internal | |
parent | Finished not so simple refactoring (diff) | |
download | trains-7ae1c766447711ee568566ba52a23f99cc92a49f.tar.gz trains-7ae1c766447711ee568566ba52a23f99cc92a49f.tar.bz2 trains-7ae1c766447711ee568566ba52a23f99cc92a49f.zip |
Refactoring of navitia mocking code for the webui
Diffstat (limited to 'internal')
-rw-r--r-- | internal/webui/root_test.go | 14 | ||||
-rw-r--r-- | internal/webui/utils_test.go | 15 |
2 files changed, 15 insertions, 14 deletions
diff --git a/internal/webui/root_test.go b/internal/webui/root_test.go index b86bb1c..7e4ec71 100644 --- a/internal/webui/root_test.go +++ b/internal/webui/root_test.go @@ -10,20 +10,6 @@ import ( "github.com/stretchr/testify/require" ) -type NavitiaMockClient struct { - departures []model.Departure - trainStops []model.Stop - err error -} - -func (c *NavitiaMockClient) GetDepartures(trainStop string) (departures []model.Departure, err error) { - return c.departures, c.err -} - -func (c *NavitiaMockClient) GetStops() (trainStops []model.Stop, err error) { - return c.trainStops, c.err -} - func TestRootHandler(t *testing.T) { // test environment setup dbEnv, err := database.InitDB("sqlite3", "file::memory:?_foreign_keys=on") diff --git a/internal/webui/utils_test.go b/internal/webui/utils_test.go index 1e07aa2..bd24dd5 100644 --- a/internal/webui/utils_test.go +++ b/internal/webui/utils_test.go @@ -9,10 +9,25 @@ import ( "strings" "testing" + "git.adyxax.org/adyxax/trains/pkg/model" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) +type NavitiaMockClient struct { + departures []model.Departure + stops []model.Stop + err error +} + +func (c *NavitiaMockClient) GetDepartures(stop string) (departures []model.Departure, err error) { + return c.departures, c.err +} + +func (c *NavitiaMockClient) GetStops() (stops []model.Stop, err error) { + return c.stops, c.err +} + var simpleErrorMessage = fmt.Errorf("") type httpTestCase struct { |