MCPcopy Index your code
hub / github.com/cli/cli / TestRunUpdate_JSON

Function TestRunUpdate_JSON

pkg/cmd/project/edit/edit_test.go:513–611  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

511}
512
513func TestRunUpdate_JSON(t *testing.T) {
514 defer gock.Off()
515 gock.Observe(gock.DumpRequest)
516
517 // get user ID
518 gock.New("https://api.github.com").
519 Post("/graphql").
520 MatchType("json").
521 JSON(map[string]interface{}{
522 "query": "query UserOrgOwner.*",
523 "variables": map[string]interface{}{
524 "login": "monalisa",
525 },
526 }).
527 Reply(200).
528 JSON(map[string]interface{}{
529 "data": map[string]interface{}{
530 "user": map[string]interface{}{
531 "id": "an ID",
532 },
533 },
534 "errors": []interface{}{
535 map[string]interface{}{
536 "type": "NOT_FOUND",
537 "path": []string{"organization"},
538 },
539 },
540 })
541
542 // get user project ID
543 gock.New("https://api.github.com").
544 Post("/graphql").
545 MatchType("json").
546 JSON(map[string]interface{}{
547 "query": "query UserProject.*",
548 "variables": map[string]interface{}{
549 "login": "monalisa",
550 "number": 1,
551 "firstItems": 0,
552 "afterItems": nil,
553 "firstFields": 0,
554 "afterFields": nil,
555 },
556 }).
557 Reply(200).
558 JSON(map[string]interface{}{
559 "data": map[string]interface{}{
560 "user": map[string]interface{}{
561 "projectV2": map[string]string{
562 "id": "an ID",
563 },
564 },
565 },
566 })
567
568 // edit project
569 gock.New("https://api.github.com").
570 Post("/graphql").

Callers

nothing calls this directly

Calls 6

NewTestClientFunction · 0.92
TestFunction · 0.92
NewJSONExporterFunction · 0.92
ReplyMethod · 0.80
runEditFunction · 0.70
StringMethod · 0.45

Tested by

no test coverage detected