MCPcopy
hub / github.com/cli/cli / TestRunLink_Team

Function TestRunLink_Team

pkg/cmd/project/link/link_test.go:296–406  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

294}
295
296func TestRunLink_Team(t *testing.T) {
297 defer gock.Off()
298 gock.Observe(gock.DumpRequest)
299
300 // get user ID
301 gock.New("https://api.github.com").
302 Post("/graphql").
303 MatchType("json").
304 JSON(map[string]interface{}{
305 "query": "query UserOrgOwner.*",
306 "variables": map[string]string{
307 "login": "monalisa-org",
308 },
309 }).
310 Reply(200).
311 JSON(map[string]interface{}{
312 "data": map[string]interface{}{
313 "user": map[string]interface{}{
314 "id": "an ID",
315 "login": "monalisa-org",
316 },
317 },
318 "errors": []interface{}{
319 map[string]interface{}{
320 "type": "NOT_FOUND",
321 "path": []string{"organization"},
322 },
323 },
324 })
325
326 // get user project ID
327 gock.New("https://api.github.com").
328 Post("/graphql").
329 MatchType("json").
330 JSON(map[string]interface{}{
331 "query": "query UserProject.*",
332 "variables": map[string]interface{}{
333 "login": "monalisa-org",
334 "number": 1,
335 "firstItems": 0,
336 "afterItems": nil,
337 "firstFields": 0,
338 "afterFields": nil,
339 },
340 }).
341 Reply(200).
342 JSON(map[string]interface{}{
343 "data": map[string]interface{}{
344 "user": map[string]interface{}{
345 "projectV2": map[string]string{
346 "id": "project-ID",
347 "title": "first-project",
348 },
349 },
350 },
351 })
352
353 // link projectV2 to team

Callers

nothing calls this directly

Calls 8

TestFunction · 0.92
NewTestClientFunction · 0.92
NewBlankConfigFunction · 0.92
runLinkFunction · 0.85
ReplyMethod · 0.80
SetStdoutTTYMethod · 0.80
EqualMethod · 0.80
StringMethod · 0.45

Tested by

no test coverage detected