(t *testing.T)
| 401 | } |
| 402 | |
| 403 | func TestAppsService_CreateInstallationToken(t *testing.T) { |
| 404 | t.Parallel() |
| 405 | client, mux, _ := setup(t) |
| 406 | |
| 407 | mux.HandleFunc("/app/installations/1/access_tokens", func(w http.ResponseWriter, r *http.Request) { |
| 408 | testMethod(t, r, "POST") |
| 409 | fmt.Fprint(w, `{"token":"t"}`) |
| 410 | }) |
| 411 | |
| 412 | ctx := t.Context() |
| 413 | token, _, err := client.Apps.CreateInstallationToken(ctx, 1, nil) |
| 414 | if err != nil { |
| 415 | t.Errorf("Apps.CreateInstallationToken returned error: %v", err) |
| 416 | } |
| 417 | |
| 418 | want := &InstallationToken{Token: Ptr("t")} |
| 419 | if !cmp.Equal(token, want) { |
| 420 | t.Errorf("Apps.CreateInstallationToken returned %+v, want %+v", token, want) |
| 421 | } |
| 422 | |
| 423 | const methodName = "CreateInstallationToken" |
| 424 | testBadOptions(t, methodName, func() (err error) { |
| 425 | _, _, err = client.Apps.CreateInstallationToken(ctx, -1, nil) |
| 426 | return err |
| 427 | }) |
| 428 | |
| 429 | testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { |
| 430 | got, resp, err := client.Apps.CreateInstallationToken(ctx, 1, nil) |
| 431 | if got != nil { |
| 432 | t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) |
| 433 | } |
| 434 | return resp, err |
| 435 | }) |
| 436 | } |
| 437 | |
| 438 | func TestAppsService_CreateInstallationTokenWithOptions(t *testing.T) { |
| 439 | t.Parallel() |
nothing calls this directly
no test coverage detected
searching dependent graphs…