(t *testing.T)
| 723 | } |
| 724 | |
| 725 | func TestRunListWeb_Org(t *testing.T) { |
| 726 | defer gock.Off() |
| 727 | gock.Observe(gock.DumpRequest) |
| 728 | // get org ID |
| 729 | gock.New("https://api.github.com"). |
| 730 | Post("/graphql"). |
| 731 | MatchType("json"). |
| 732 | JSON(map[string]interface{}{ |
| 733 | "query": "query UserOrgOwner.*", |
| 734 | "variables": map[string]interface{}{ |
| 735 | "login": "github", |
| 736 | }, |
| 737 | }). |
| 738 | Reply(200). |
| 739 | JSON(map[string]interface{}{ |
| 740 | "data": map[string]interface{}{ |
| 741 | "organization": map[string]interface{}{ |
| 742 | "id": "an ID", |
| 743 | }, |
| 744 | }, |
| 745 | "errors": []interface{}{ |
| 746 | map[string]interface{}{ |
| 747 | "type": "NOT_FOUND", |
| 748 | "path": []string{"user"}, |
| 749 | }, |
| 750 | }, |
| 751 | }) |
| 752 | |
| 753 | client := queries.NewTestClient() |
| 754 | buf := bytes.Buffer{} |
| 755 | config := listConfig{ |
| 756 | opts: listOpts{ |
| 757 | owner: "github", |
| 758 | web: true, |
| 759 | }, |
| 760 | URLOpener: func(url string) error { |
| 761 | buf.WriteString(url) |
| 762 | return nil |
| 763 | }, |
| 764 | client: client, |
| 765 | } |
| 766 | |
| 767 | err := runList(config) |
| 768 | assert.NoError(t, err) |
| 769 | assert.Equal(t, "https://github.com/orgs/github/projects", buf.String()) |
| 770 | } |
| 771 | |
| 772 | func TestRunListWeb_Me(t *testing.T) { |
| 773 | defer gock.Off() |
nothing calls this directly
no test coverage detected