(t *testing.T)
| 770 | } |
| 771 | |
| 772 | func TestRunListWeb_Me(t *testing.T) { |
| 773 | defer gock.Off() |
| 774 | gock.Observe(gock.DumpRequest) |
| 775 | |
| 776 | // get viewer ID |
| 777 | gock.New("https://api.github.com"). |
| 778 | Post("/graphql"). |
| 779 | MatchType("json"). |
| 780 | JSON(map[string]interface{}{ |
| 781 | "query": "query Viewer.*", |
| 782 | }). |
| 783 | Reply(200). |
| 784 | JSON(map[string]interface{}{ |
| 785 | "data": map[string]interface{}{ |
| 786 | "viewer": map[string]interface{}{ |
| 787 | "id": "an ID", |
| 788 | "login": "theviewer", |
| 789 | }, |
| 790 | }, |
| 791 | }) |
| 792 | |
| 793 | client := queries.NewTestClient() |
| 794 | buf := bytes.Buffer{} |
| 795 | config := listConfig{ |
| 796 | opts: listOpts{ |
| 797 | owner: "@me", |
| 798 | web: true, |
| 799 | }, |
| 800 | URLOpener: func(url string) error { |
| 801 | buf.WriteString(url) |
| 802 | return nil |
| 803 | }, |
| 804 | client: client, |
| 805 | } |
| 806 | |
| 807 | err := runList(config) |
| 808 | assert.NoError(t, err) |
| 809 | assert.Equal(t, "https://github.com/users/theviewer/projects", buf.String()) |
| 810 | } |
| 811 | |
| 812 | func TestRunListWeb_Empty(t *testing.T) { |
| 813 | defer gock.Off() |
nothing calls this directly
no test coverage detected