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

Function TestRunAddItem_Org

pkg/cmd/project/item-add/item_add_test.go:236–345  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

234}
235
236func TestRunAddItem_Org(t *testing.T) {
237 defer gock.Off()
238 gock.Observe(gock.DumpRequest)
239 // get org ID
240 gock.New("https://api.github.com").
241 Post("/graphql").
242 MatchType("json").
243 JSON(map[string]any{
244 "query": "query UserOrgOwner.*",
245 "variables": map[string]any{
246 "login": "github",
247 },
248 }).
249 Reply(200).
250 JSON(map[string]any{
251 "data": map[string]any{
252 "organization": map[string]any{
253 "id": "an ID",
254 },
255 },
256 "errors": []any{
257 map[string]any{
258 "type": "NOT_FOUND",
259 "path": []string{"user"},
260 },
261 },
262 })
263
264 // get project ID
265 gock.New("https://api.github.com").
266 Post("/graphql").
267 MatchType("json").
268 JSON(map[string]any{
269 "query": "query OrgProject.*",
270 "variables": map[string]any{
271 "login": "github",
272 "number": 1,
273 "firstItems": 0,
274 "afterItems": nil,
275 "firstFields": 0,
276 "afterFields": nil,
277 },
278 }).
279 Reply(200).
280 JSON(map[string]any{
281 "data": map[string]any{
282 "organization": map[string]any{
283 "projectV2": map[string]any{
284 "id": "an ID",
285 },
286 },
287 },
288 })
289
290 // get item ID
291 gock.New("https://api.github.com").
292 Post("/graphql").
293 MatchType("json").

Callers

nothing calls this directly

Calls 7

NewTestClientFunction · 0.92
TestFunction · 0.92
runAddItemFunction · 0.85
ReplyMethod · 0.80
SetStdoutTTYMethod · 0.80
EqualMethod · 0.80
StringMethod · 0.65

Tested by

no test coverage detected