(t *testing.T)
| 228 | } |
| 229 | |
| 230 | func TestGistsService_List_specifiedUser(t *testing.T) { |
| 231 | t.Parallel() |
| 232 | client, mux, _ := setup(t) |
| 233 | |
| 234 | since := "2013-01-01T00:00:00Z" |
| 235 | |
| 236 | mux.HandleFunc("/users/u/gists", func(w http.ResponseWriter, r *http.Request) { |
| 237 | testMethod(t, r, "GET") |
| 238 | testFormValues(t, r, values{ |
| 239 | "since": since, |
| 240 | }) |
| 241 | fmt.Fprint(w, `[{"id": "1"}]`) |
| 242 | }) |
| 243 | |
| 244 | opt := &GistListOptions{Since: time.Date(2013, time.January, 1, 0, 0, 0, 0, time.UTC)} |
| 245 | ctx := t.Context() |
| 246 | gists, _, err := client.Gists.List(ctx, "u", opt) |
| 247 | if err != nil { |
| 248 | t.Errorf("Gists.List returned error: %v", err) |
| 249 | } |
| 250 | |
| 251 | want := []*Gist{{ID: Ptr("1")}} |
| 252 | if !cmp.Equal(gists, want) { |
| 253 | t.Errorf("Gists.List returned %+v, want %+v", gists, want) |
| 254 | } |
| 255 | |
| 256 | const methodName = "List" |
| 257 | testBadOptions(t, methodName, func() (err error) { |
| 258 | _, _, err = client.Gists.List(ctx, "\n", opt) |
| 259 | return err |
| 260 | }) |
| 261 | |
| 262 | testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { |
| 263 | got, resp, err := client.Gists.List(ctx, "u", opt) |
| 264 | if got != nil { |
| 265 | t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) |
| 266 | } |
| 267 | return resp, err |
| 268 | }) |
| 269 | } |
| 270 | |
| 271 | func TestGistsService_List_authenticatedUser(t *testing.T) { |
| 272 | t.Parallel() |
nothing calls this directly
no test coverage detected
searching dependent graphs…