MCPcopy Create free account
hub / github.com/Azure/peerd / TestContextCop

Function TestContextCop

pkg/context/context_test.go:219–238  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

217}
218
219func TestContextCop(t *testing.T) {
220 // Create a new request without any correlation ID headers.
221 req, err := http.NewRequest("GET", "http://127.0.0.1:5000/blobs/fdsfsdsd", nil)
222 if err != nil {
223 t.Fatal(err)
224 }
225
226 ctx, _ := gin.CreateTestContext(httptest.NewRecorder())
227 ctx.Request = req
228
229 pc := FromContext(ctx)
230
231 pcCopy := pc.Copy()
232 if pcCopy.Request == nil {
233 t.Fatal("expected context copy request to not be nil")
234 }
235 if pcCopy.Request != pc.Request {
236 t.Fatal("expected context copy request to be the same as original")
237 }
238}

Callers

nothing calls this directly

Calls 2

CopyMethod · 0.80
FromContextFunction · 0.70

Tested by

no test coverage detected