(t *testing.T)
| 14 | ) |
| 15 | |
| 16 | func 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 | |
| 55 | func TestCodesOfConductService_Get(t *testing.T) { |
| 56 | t.Parallel() |
nothing calls this directly
no test coverage detected
searching dependent graphs…