forked from vsimakhin/web-logbook
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhandlers_map_test.go
46 lines (30 loc) · 959 Bytes
/
handlers_map_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package main
import (
"fmt"
"net/http"
"net/http/httptest"
"testing"
"github.com/stretchr/testify/assert"
"github.com/vsimakhin/web-logbook/internal/models"
)
func TestHandlerMap(t *testing.T) {
app, mock := initTestApplication()
models.InitMock(mock, "GetSettings")
models.InitMock(mock, "GetSettings")
models.InitMock(mock, "GetAircraftsModels")
models.InitMock(mock, "GetAircraftsRegs")
srv := httptest.NewServer(app.routes())
defer srv.Close()
resp, _ := http.Get(fmt.Sprintf("%s%s", srv.URL, APIMap))
assert.Equal(t, http.StatusOK, resp.StatusCode)
}
func TestHandlerMapGetData(t *testing.T) {
app, mock := initTestApplication()
models.InitMock(mock, "GetSettings")
models.InitMock(mock, "GetFlightRecords")
models.InitMock(mock, "GetAirports")
srv := httptest.NewServer(app.routes())
defer srv.Close()
resp, _ := http.Get(fmt.Sprintf("%s%s", srv.URL, APIMapData))
assert.Equal(t, http.StatusOK, resp.StatusCode)
}