MCPcopy
hub / github.com/cli/cli / Exclude

Method Exclude

pkg/httpmock/registry.go:32–53  ·  view source on GitHub ↗
(t *testing.T, m Matcher)

Source from the content-addressed store, hash-verified

30}
31
32func (r *Registry) Exclude(t *testing.T, m Matcher) {
33 registrationStack := string(debug.Stack())
34
35 excludedStub := &Stub{
36 Matcher: m,
37 Responder: func(req *http.Request) (*http.Response, error) {
38 callStack := string(debug.Stack())
39
40 var errMsg strings.Builder
41 errMsg.WriteString("HTTP call was made when it should have been excluded:\n")
42 errMsg.WriteString(fmt.Sprintf("Request URL: %s\n", req.URL))
43 errMsg.WriteString(fmt.Sprintf("Was excluded by: %s\n", registrationStack))
44 errMsg.WriteString(fmt.Sprintf("Was called from: %s\n", callStack))
45
46 t.Error(errMsg.String())
47 t.FailNow()
48 return nil, nil
49 },
50 exclude: true,
51 }
52 r.stubs = append(r.stubs, excludedStub)
53}
54
55type Testing interface {
56 Errorf(string, ...interface{})

Callers 15

TestApiActorsSupportedFunction · 0.95
Test_editRunFunction · 0.95
Test_createRun_GHESFunction · 0.95
Test_generateCompareURLFunction · 0.95
Test_editRunFunction · 0.95

Calls 2

ErrorMethod · 0.45
StringMethod · 0.45

Tested by 15

TestApiActorsSupportedFunction · 0.76
Test_editRunFunction · 0.76
Test_createRun_GHESFunction · 0.76
Test_generateCompareURLFunction · 0.76
Test_editRunFunction · 0.76