Skip to content

Commit 8a32e50

Browse files
committed
Fix lint
1 parent 4704057 commit 8a32e50

File tree

2 files changed

+11
-14
lines changed

2 files changed

+11
-14
lines changed

modules/test/context_tests.go

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,24 +27,23 @@ import (
2727

2828
// MockContext mock context for unit tests
2929
func MockContext(t *testing.T, path string) *context.Context {
30+
requestURL, err := url.Parse(path)
31+
assert.NoError(t, err)
32+
3033
var resp = &mockResponseWriter{}
34+
var req = &http.Request{
35+
URL: requestURL,
36+
Form: url.Values{},
37+
}
3138
var ctx = context.Context{
32-
Render: &mockRender{},
33-
Data: make(map[string]interface{}),
39+
BaseContext: context.NewBaseContext(resp, req, map[string]interface{}{}),
40+
Render: &mockRender{},
3441
Flash: &middleware.Flash{
3542
Values: make(url.Values),
3643
},
37-
Resp: context.NewResponse(resp),
3844
Locale: &mockLocale{},
3945
}
4046

41-
requestURL, err := url.Parse(path)
42-
assert.NoError(t, err)
43-
var req = &http.Request{
44-
URL: requestURL,
45-
Form: url.Values{},
46-
}
47-
4847
chiCtx := chi.NewRouteContext()
4948
req = req.WithContext(scontext.WithValue(req.Context(), chi.RouteCtxKey, chiCtx))
5049
ctx.Req = context.WithContext(req, &ctx)

routers/api/v1/misc/markdown_test.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,8 @@ func createContext(req *http.Request) (*context.Context, *httptest.ResponseRecor
3030
var rnd = templates.HTMLRenderer()
3131
resp := httptest.NewRecorder()
3232
c := &context.Context{
33-
Req: req,
34-
Resp: context.NewResponse(resp),
35-
Render: rnd,
36-
Data: make(map[string]interface{}),
33+
BaseContext: context.NewBaseContext(resp, req, map[string]interface{}{}),
34+
Render: rnd,
3735
}
3836
return c, resp
3937
}

0 commit comments

Comments
 (0)