(t *testing.T)
| 26 | ) |
| 27 | |
| 28 | func TestNotSupportedVersions(t *testing.T) { |
| 29 | testCases := []struct { |
| 30 | path string |
| 31 | }{ |
| 32 | // v1 |
| 33 | { |
| 34 | path: "/api/v1", |
| 35 | }, |
| 36 | { |
| 37 | path: "/api/v1/foo", |
| 38 | }, |
| 39 | { |
| 40 | path: "/api/v1/bar/baz", |
| 41 | }, |
| 42 | // v2 |
| 43 | { |
| 44 | path: "/api/v2", |
| 45 | }, |
| 46 | { |
| 47 | path: "/api/v2/foo", |
| 48 | }, |
| 49 | { |
| 50 | path: "/api/v2/bar/baz", |
| 51 | }, |
| 52 | } |
| 53 | |
| 54 | // setup |
| 55 | db := testutils.InitMemoryDB(t) |
| 56 | a := app.NewTest() |
| 57 | a.Clock = clock.NewMock() |
| 58 | a.DB = db |
| 59 | server := MustNewServer(t, &a) |
| 60 | defer server.Close() |
| 61 | |
| 62 | for _, tc := range testCases { |
| 63 | t.Run(tc.path, func(t *testing.T) { |
| 64 | // execute |
| 65 | req := testutils.MakeReq(server.URL, "GET", tc.path, "") |
| 66 | res := testutils.HTTPDo(t, req) |
| 67 | |
| 68 | // test |
| 69 | assert.Equal(t, res.StatusCode, http.StatusGone, "status code mismatch") |
| 70 | }) |
| 71 | } |
| 72 | } |
nothing calls this directly
no test coverage detected