refactor(server/api/test): withUser helper; migrate 51 context-value sites (A3)
This commit is contained in:
@@ -64,7 +64,7 @@ func newAdminTracksRouter(h *handlers) chi.Router {
|
||||
func doAdminTracksReq(t *testing.T, h *handlers, method, path string, user dbq.User) *httptest.ResponseRecorder {
|
||||
t.Helper()
|
||||
req := httptest.NewRequest(method, path, bytes.NewBuffer(nil))
|
||||
req = req.WithContext(context.WithValue(req.Context(), userCtxKeyForTest(), user))
|
||||
req = withUser(req, user)
|
||||
w := httptest.NewRecorder()
|
||||
newAdminTracksRouter(h).ServeHTTP(w, req)
|
||||
return w
|
||||
|
||||
Reference in New Issue
Block a user