(t *testing.T)
| 511 | } |
| 512 | |
| 513 | func 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"). |
nothing calls this directly
no test coverage detected