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

Function TestRunClose_Org

pkg/cmd/project/close/close_test.go:187–276  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

185}
186
187func TestRunClose_Org(t *testing.T) {
188 defer gock.Off()
189 // gock.Observe(gock.DumpRequest)
190
191 // get org ID
192 gock.New("https://api.github.com").
193 Post("/graphql").
194 MatchType("json").
195 JSON(map[string]any{
196 "query": "query UserOrgOwner.*",
197 "variables": map[string]any{
198 "login": "github",
199 },
200 }).
201 Reply(200).
202 JSON(map[string]any{
203 "data": map[string]any{
204 "organization": map[string]any{
205 "id": "an ID",
206 },
207 },
208 "errors": []any{
209 map[string]any{
210 "type": "NOT_FOUND",
211 "path": []string{"user"},
212 },
213 },
214 })
215
216 // get org project ID
217 gock.New("https://api.github.com").
218 Post("/graphql").
219 MatchType("json").
220 JSON(map[string]any{
221 "query": "query OrgProject.*",
222 "variables": map[string]any{
223 "login": "github",
224 "number": 1,
225 "firstItems": 0,
226 "afterItems": nil,
227 "firstFields": 0,
228 "afterFields": nil,
229 },
230 }).
231 Reply(200).
232 JSON(map[string]any{
233 "data": map[string]any{
234 "organization": map[string]any{
235 "projectV2": map[string]string{
236 "id": "an ID",
237 },
238 },
239 },
240 })
241
242 // close project
243 gock.New("https://api.github.com").
244 Post("/graphql").

Callers

nothing calls this directly

Calls 6

NewTestClientFunction · 0.92
TestFunction · 0.92
runCloseFunction · 0.85
ReplyMethod · 0.80
EqualMethod · 0.80
StringMethod · 0.65

Tested by

no test coverage detected