MCPcopy Index your code
hub / github.com/google/go-github / TestRepositoriesService_ListContributors

Function TestRepositoriesService_ListContributors

github/repos_test.go:741–779  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

739}
740
741func 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
781func TestRepositoriesService_ListLanguages(t *testing.T) {
782 t.Parallel()

Callers

nothing calls this directly

Calls 8

testMethodFunction · 0.85
testFormValuesFunction · 0.85
testBadOptionsFunction · 0.85
ListContributorsMethod · 0.80
EqualMethod · 0.80
setupFunction · 0.70
PtrFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…