(t *testing.T)
| 454 | } |
| 455 | |
| 456 | func TestRunClose_JSON(t *testing.T) { |
| 457 | defer gock.Off() |
| 458 | // gock.Observe(gock.DumpRequest) |
| 459 | |
| 460 | // get user ID |
| 461 | gock.New("https://api.github.com"). |
| 462 | Post("/graphql"). |
| 463 | MatchType("json"). |
| 464 | JSON(map[string]interface{}{ |
| 465 | "query": "query UserOrgOwner.*", |
| 466 | "variables": map[string]interface{}{ |
| 467 | "login": "monalisa", |
| 468 | }, |
| 469 | }). |
| 470 | Reply(200). |
| 471 | JSON(map[string]interface{}{ |
| 472 | "data": map[string]interface{}{ |
| 473 | "user": map[string]interface{}{ |
| 474 | "id": "an ID", |
| 475 | }, |
| 476 | }, |
| 477 | "errors": []interface{}{ |
| 478 | map[string]interface{}{ |
| 479 | "type": "NOT_FOUND", |
| 480 | "path": []string{"organization"}, |
| 481 | }, |
| 482 | }, |
| 483 | }) |
| 484 | |
| 485 | // get user project ID |
| 486 | gock.New("https://api.github.com"). |
| 487 | Post("/graphql"). |
| 488 | MatchType("json"). |
| 489 | JSON(map[string]interface{}{ |
| 490 | "query": "query UserProject.*", |
| 491 | "variables": map[string]interface{}{ |
| 492 | "login": "monalisa", |
| 493 | "number": 1, |
| 494 | "firstItems": 0, |
| 495 | "afterItems": nil, |
| 496 | "firstFields": 0, |
| 497 | "afterFields": nil, |
| 498 | }, |
| 499 | }). |
| 500 | Reply(200). |
| 501 | JSON(map[string]interface{}{ |
| 502 | "data": map[string]interface{}{ |
| 503 | "user": map[string]interface{}{ |
| 504 | "projectV2": map[string]string{ |
| 505 | "id": "an ID", |
| 506 | }, |
| 507 | }, |
| 508 | }, |
| 509 | }) |
| 510 | |
| 511 | // close project |
| 512 | gock.New("https://api.github.com"). |
| 513 | Post("/graphql"). |
nothing calls this directly
no test coverage detected