(t *testing.T)
| 739 | } |
| 740 | |
| 741 | func TestRepositoriesService_ListContributors(t *testing.T) { |
| 742 | t.Parallel() |
| 743 | client, mux, _ := setup(t) |
| 744 | |
| 745 | mux.HandleFunc("/repos/o/r/contributors", func(w http.ResponseWriter, r *http.Request) { |
| 746 | testMethod(t, r, "GET") |
| 747 | testFormValues(t, r, values{ |
| 748 | "anon": "true", |
| 749 | "page": "2", |
| 750 | }) |
| 751 | fmt.Fprint(w, `[{"contributions":42}]`) |
| 752 | }) |
| 753 | |
| 754 | opts := &ListContributorsOptions{Anon: "true", ListOptions: ListOptions{Page: 2}} |
| 755 | ctx := t.Context() |
| 756 | contributors, _, err := client.Repositories.ListContributors(ctx, "o", "r", opts) |
| 757 | if err != nil { |
| 758 | t.Errorf("Repositories.ListContributors returned error: %v", err) |
| 759 | } |
| 760 | |
| 761 | want := []*Contributor{{Contributions: Ptr(42)}} |
| 762 | if !cmp.Equal(contributors, want) { |
| 763 | t.Errorf("Repositories.ListContributors returned %+v, want %+v", contributors, want) |
| 764 | } |
| 765 | |
| 766 | const methodName = "ListContributors" |
| 767 | testBadOptions(t, methodName, func() (err error) { |
| 768 | _, _, err = client.Repositories.ListContributors(ctx, "\n", "\n", opts) |
| 769 | return err |
| 770 | }) |
| 771 | |
| 772 | testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { |
| 773 | got, resp, err := client.Repositories.ListContributors(ctx, "o", "r", opts) |
| 774 | if got != nil { |
| 775 | t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) |
| 776 | } |
| 777 | return resp, err |
| 778 | }) |
| 779 | } |
| 780 | |
| 781 | func TestRepositoriesService_ListLanguages(t *testing.T) { |
| 782 | t.Parallel() |
nothing calls this directly
no test coverage detected
searching dependent graphs…