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

Function Test_getExtensionRepos

pkg/cmd/extension/browse/browse_test.go:68–191  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

66}
67
68func Test_getExtensionRepos(t *testing.T) {
69 reg := httpmock.Registry{}
70 defer reg.Verify(t)
71
72 client := &http.Client{Transport: &reg}
73
74 values := url.Values{
75 "page": []string{"1"},
76 "per_page": []string{"100"},
77 "q": []string{"topic:gh-extension"},
78 }
79 cfg := config.NewBlankConfig()
80
81 cfg.AuthenticationFunc = func() gh.AuthConfig {
82 authCfg := &config.AuthConfig{}
83 authCfg.SetDefaultHost("github.com", "")
84 return authCfg
85 }
86
87 reg.Register(
88 httpmock.QueryMatcher("GET", "search/repositories", values),
89 httpmock.JSONResponse(map[string]interface{}{
90 "incomplete_results": false,
91 "total_count": 4,
92 "items": []interface{}{
93 map[string]interface{}{
94 "name": "gh-screensaver",
95 "full_name": "vilmibm/gh-screensaver",
96 "description": "terminal animations",
97 "owner": map[string]interface{}{
98 "login": "vilmibm",
99 },
100 },
101 map[string]interface{}{
102 "name": "gh-cool",
103 "full_name": "cli/gh-cool",
104 "description": "it's just cool ok",
105 "owner": map[string]interface{}{
106 "login": "cli",
107 },
108 },
109 map[string]interface{}{
110 "name": "gh-triage",
111 "full_name": "samcoe/gh-triage",
112 "description": "helps with triage",
113 "owner": map[string]interface{}{
114 "login": "samcoe",
115 },
116 },
117 map[string]interface{}{
118 "name": "gh-gei",
119 "full_name": "github/gh-gei",
120 "description": "something something enterprise",
121 "owner": map[string]interface{}{
122 "login": "github",
123 },
124 },
125 },

Callers

nothing calls this directly

Calls 9

VerifyMethod · 0.95
SetDefaultHostMethod · 0.95
RegisterMethod · 0.95
NewBlankConfigFunction · 0.92
QueryMatcherFunction · 0.92
JSONResponseFunction · 0.92
NewSearcherFunction · 0.92
getExtensionsFunction · 0.85
EqualMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…