MCPcopy Create free account
hub / github.com/cli/cli / stubDiffRequest

Function stubDiffRequest

pkg/cmd/pr/diff/diff_test.go:508–526  ·  view source on GitHub ↗
(reg *httpmock.Registry, accept, diff string)

Source from the content-addressed store, hash-verified

506}
507
508func stubDiffRequest(reg *httpmock.Registry, accept, diff string) {
509 reg.Register(
510 func(req *http.Request) bool {
511 if !strings.EqualFold(req.Method, "GET") {
512 return false
513 }
514 if req.URL.EscapedPath() != "/repos/OWNER/REPO/pulls/123" {
515 return false
516 }
517 return req.Header.Get("Accept") == accept
518 },
519 func(req *http.Request) (*http.Response, error) {
520 return &http.Response{
521 StatusCode: 200,
522 Request: req,
523 Body: io.NopCloser(strings.NewReader(diff)),
524 }, nil
525 })
526}
527
528func Test_filterDiff(t *testing.T) {
529 rawDiff := fmt.Sprintf(testDiff, "", "", "", "")

Callers 1

Test_diffRunFunction · 0.85

Calls 2

GetMethod · 0.65
RegisterMethod · 0.45

Tested by

no test coverage detected