diff --git a/flights_test.go b/flights_test.go index e8a100a..3efc419 100644 --- a/flights_test.go +++ b/flights_test.go @@ -59,6 +59,14 @@ var _ = Describe("Flights", func() { defer gock.Off() + gock.New(gopensky.OpenSkyAPIURL). + Get("/flights/invalid"). + Reply(200). + BodyString("") + + _, err = gopensky.GetArrivalsByAirport(conn, "KEWR", 1696755342, 1696928142) + Expect(err.Error()).To(ContainSubstring("do request: Get")) + gock.New(gopensky.OpenSkyAPIURL). Get("/flights/arrival"). Reply(200). @@ -114,6 +122,14 @@ var _ = Describe("Flights", func() { defer gock.Off() + gock.New(gopensky.OpenSkyAPIURL). + Get("/flights/invalid"). + Reply(200). + BodyString("") + + _, err = gopensky.GetDeparturesByAirport(conn, "KEWR", 1696755342, 1696928142) + Expect(err.Error()).To(ContainSubstring("do request: Get")) + gock.New(gopensky.OpenSkyAPIURL). Get("/flights/departure"). Reply(200). @@ -169,6 +185,14 @@ var _ = Describe("Flights", func() { defer gock.Off() + gock.New(gopensky.OpenSkyAPIURL). + Get("/flights/invalid"). + Reply(200). + BodyString("") + + _, err = gopensky.GetFlightsByInterval(conn, 1696755342, 1696928142) + Expect(err.Error()).To(ContainSubstring("do request: Get")) + gock.New(gopensky.OpenSkyAPIURL). Get("/flights/all"). Reply(200). @@ -220,6 +244,15 @@ var _ = Describe("Flights", func() { gock.InterceptClient(gclient) defer gock.Off() + + gock.New(gopensky.OpenSkyAPIURL). + Get("/flights/invalid"). + Reply(200). + BodyString("") + + _, err = gopensky.GetFlightsByAircraft(conn, "c060b9", 1696755342, 1696928142) + Expect(err.Error()).To(ContainSubstring("do request: Get")) + gock.New(gopensky.OpenSkyAPIURL). Get("/flights/aircraft"). Reply(200). diff --git a/states_test.go b/states_test.go index 3a67886..3acce68 100644 --- a/states_test.go +++ b/states_test.go @@ -71,6 +71,13 @@ var _ = Describe("States", func() { defer gock.Off() + gock.New(gopensky.OpenSkyAPIURL). + Get("/states/invalid"). + Reply(200). + BodyString("") + _, err = gopensky.GetStates(conn, 0, nil, nil, false) + Expect(err.Error()).To(ContainSubstring("do request: Get")) + gock.New(gopensky.OpenSkyAPIURL). Get("/states/all"). Reply(200). diff --git a/tracks_test.go b/tracks_test.go index ebefc97..5d5a28a 100644 --- a/tracks_test.go +++ b/tracks_test.go @@ -66,6 +66,14 @@ var _ = Describe("Tracks", func() { _, err = gopensky.GetTrackByAircraft(conn, "c060b9", 1689193028) Expect(err.Error()).To(ContainSubstring("unmarshalling")) + gock.New(gopensky.OpenSkyAPIURL). + Get("/tracks/invalid"). + Reply(200). + BodyString("") + + _, err = gopensky.GetTrackByAircraft(conn, "c060b9", 1689193028) + Expect(err.Error()).To(ContainSubstring("do request: Get")) + for _, tfile := range []string{"tracks01.json", "tracks02.json", "tracks03.json", "tracks04.json"} { gock.New(gopensky.OpenSkyAPIURL). Get("/tracks/all").