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

Function TestCodesOfConductService_List

github/codesofconduct_test.go:16–53  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

14)
15
16func TestCodesOfConductService_List(t *testing.T) {
17 t.Parallel()
18 client, mux, _ := setup(t)
19
20 mux.HandleFunc("/codes_of_conduct", func(w http.ResponseWriter, r *http.Request) {
21 testMethod(t, r, "GET")
22 testHeader(t, r, "Accept", mediaTypeCodesOfConductPreview)
23 fmt.Fprint(w, `[{
24 "key": "key",
25 "name": "name",
26 "url": "url"}
27 ]`)
28 })
29
30 ctx := t.Context()
31 cs, _, err := client.ListCodesOfConduct(ctx)
32 assertNilError(t, err)
33
34 want := []*CodeOfConduct{
35 {
36 Key: Ptr("key"),
37 Name: Ptr("name"),
38 URL: Ptr("url"),
39 },
40 }
41 if !cmp.Equal(want, cs) {
42 t.Errorf("returned %+v, want %+v", cs, want)
43 }
44
45 const methodName = "List"
46 testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
47 got, resp, err := client.CodesOfConduct.List(ctx)
48 if got != nil {
49 t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got)
50 }
51 return resp, err
52 })
53}
54
55func TestCodesOfConductService_Get(t *testing.T) {
56 t.Parallel()

Callers

nothing calls this directly

Calls 9

testMethodFunction · 0.85
testHeaderFunction · 0.85
ListCodesOfConductMethod · 0.80
EqualMethod · 0.80
setupFunction · 0.70
assertNilErrorFunction · 0.70
PtrFunction · 0.70
ListMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…