MCPcopy
hub / github.com/cli/cli / TestRunCopy_Me

Function TestRunCopy_Me

pkg/cmd/project/copy/copy_test.go:358–461  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

356}
357
358func TestRunCopy_Me(t *testing.T) {
359 defer gock.Off()
360 // gock.Observe(gock.DumpRequest)
361
362 // get viewer project ID
363 gock.New("https://api.github.com").
364 Post("/graphql").
365 MatchType("json").
366 JSON(map[string]interface{}{
367 "query": "query ViewerProject.*",
368 "variables": map[string]interface{}{
369 "number": 1,
370 "firstItems": 0,
371 "afterItems": nil,
372 "firstFields": 0,
373 "afterFields": nil,
374 },
375 }).
376 Reply(200).
377 JSON(map[string]interface{}{
378 "data": map[string]interface{}{
379 "viewer": map[string]interface{}{
380 "projectV2": map[string]string{
381 "id": "an ID",
382 },
383 },
384 },
385 })
386
387 // get source viewer ID
388 gock.New("https://api.github.com").
389 Post("/graphql").
390 MatchType("json").
391 JSON(map[string]interface{}{
392 "query": "query ViewerOwner.*",
393 }).
394 Reply(200).
395 JSON(map[string]interface{}{
396 "data": map[string]interface{}{
397 "viewer": map[string]interface{}{
398 "id": "an ID",
399 "login": "me",
400 },
401 },
402 })
403
404 // get target viewer ID
405 gock.New("https://api.github.com").
406 Post("/graphql").
407 MatchType("json").
408 JSON(map[string]interface{}{
409 "query": "query ViewerOwner.*",
410 }).
411 Reply(200).
412 JSON(map[string]interface{}{
413 "data": map[string]interface{}{
414 "viewer": map[string]interface{}{
415 "id": "an ID",

Callers

nothing calls this directly

Calls 7

NewTestClientFunction · 0.92
TestFunction · 0.92
runCopyFunction · 0.85
ReplyMethod · 0.80
SetStdoutTTYMethod · 0.80
EqualMethod · 0.80
StringMethod · 0.45

Tested by

no test coverage detected