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

Function TestRepositoriesService_ListByAuthenticatedUser

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

Source from the content-addressed store, hash-verified

19)
20
21func TestRepositoriesService_ListByAuthenticatedUser(t *testing.T) {
22 t.Parallel()
23 client, mux, _ := setup(t)
24
25 mux.HandleFunc("/user/repos", func(w http.ResponseWriter, r *http.Request) {
26 testMethod(t, r, "GET")
27 fmt.Fprint(w, `[{"id":1},{"id":2}]`)
28 })
29
30 ctx := t.Context()
31 got, _, err := client.Repositories.ListByAuthenticatedUser(ctx, nil)
32 if err != nil {
33 t.Errorf("Repositories.List returned error: %v", err)
34 }
35
36 want := []*Repository{{ID: Ptr(int64(1))}, {ID: Ptr(int64(2))}}
37 if !cmp.Equal(got, want) {
38 t.Errorf("Repositories.ListByAuthenticatedUser returned %+v, want %+v", got, want)
39 }
40
41 const methodName = "ListByAuthenticatedUser"
42
43 testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
44 got, resp, err := client.Repositories.ListByAuthenticatedUser(ctx, nil)
45 if got != nil {
46 t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got)
47 }
48 return resp, err
49 })
50}
51
52func TestRepositoriesService_ListByUser(t *testing.T) {
53 t.Parallel()

Callers

nothing calls this directly

Calls 6

testMethodFunction · 0.85
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…