onasty/e2e/api_test.go (view raw)
Smirnov Oleksandr
Smirnov Oleksandr
ss2316544@gmail.com refactor: fix annoyances (#97)..., 1 year ago
ss2316544@gmail.com refactor: fix annoyances (#97)..., 1 year ago
| 1 | package e2e_test |
| 2 | |
| 3 | import "net/http" |
| 4 | |
| 5 | type apiPingResponse struct { |
| 6 | Message string `json:"message"` |
| 7 | } |
| 8 | |
| 9 | func (e *AppTestSuite) TestPing() { |
| 10 | httpResp := e.httpRequest(http.MethodGet, "/api/ping", nil) |
| 11 | |
| 12 | var body apiPingResponse |
| 13 | e.readBodyAndUnjsonify(httpResp.Body, &body) |
| 14 | |
| 15 | e.Equal(http.StatusOK, httpResp.Code) |
| 16 | e.Equal(body.Message, "pong") |
| 17 | } |