MCPcopy Index your code
hub / github.com/coder/coder / setupPushTest

Function setupPushTest

coderd/webpush/webpush_test.go:526–530  ·  view source on GitHub ↗

setupPushTest creates a common test setup for webpush notification tests. The test HTTP client bypasses SSRF protection so that httptest.Server (bound to 127.0.0.1) can be reached.

(ctx context.Context, t *testing.T, handlerFunc func(w http.ResponseWriter, r *http.Request))

Source from the content-addressed store, hash-verified

524// The test HTTP client bypasses SSRF protection so that httptest.Server
525// (bound to 127.0.0.1) can be reached.
526func setupPushTest(ctx context.Context, t *testing.T, handlerFunc func(w http.ResponseWriter, r *http.Request)) (webpush.Dispatcher, database.Store, string) {
527 t.Helper()
528 db, _ := dbtestutil.NewDB(t)
529 return setupPushTestWithOptions(ctx, t, db, handlerFunc)
530}
531
532func setupPushTestWithOptions(ctx context.Context, t *testing.T, db database.Store, handlerFunc func(w http.ResponseWriter, r *http.Request), opts ...webpush.Option) (webpush.Dispatcher, database.Store, string) {
533 t.Helper()

Callers 1

TestPushFunction · 0.85

Calls 3

NewDBFunction · 0.92
setupPushTestWithOptionsFunction · 0.85
HelperMethod · 0.65

Tested by

no test coverage detected