Fixing tests and addressing comments

This commit is contained in:
Denis Makogon
2017-07-17 20:54:42 +03:00
parent 48484be608
commit 4f5197a1c2

View File

@@ -115,6 +115,9 @@ func TestRoutePut(t *testing.T) {
func TestRouteDelete(t *testing.T) { func TestRouteDelete(t *testing.T) {
buf := setLogBuffer() buf := setLogBuffer()
routes := models.Routes{{AppName: "a", Path: "/myroute",}}
apps := []*models.App{{Name: "a", Routes: routes, Config: nil}}
for i, test := range []struct { for i, test := range []struct {
ds models.Datastore ds models.Datastore
logDB models.FnLog logDB models.FnLog
@@ -124,10 +127,7 @@ func TestRouteDelete(t *testing.T) {
expectedError error expectedError error
}{ }{
{datastore.NewMock(), logs.NewMock(), "/v1/apps/a/routes/missing", "", http.StatusNotFound, models.ErrRoutesNotFound}, {datastore.NewMock(), logs.NewMock(), "/v1/apps/a/routes/missing", "", http.StatusNotFound, models.ErrRoutesNotFound},
{datastore.NewMockInit(nil, {datastore.NewMockInit(apps, routes, nil, nil,
[]*models.Route{
{Path: "/myroute", AppName: "a"},
}, nil, nil,
), logs.NewMock(), "/v1/apps/a/routes/myroute", "", http.StatusOK, nil}, ), logs.NewMock(), "/v1/apps/a/routes/myroute", "", http.StatusOK, nil},
} { } {
rnr, cancel := testRunner(t) rnr, cancel := testRunner(t)