(t *testing.T)
| 55 | } |
| 56 | |
| 57 | func TestAuthorizationsService_Reset(t *testing.T) { |
| 58 | t.Parallel() |
| 59 | client, mux, _ := setup(t) |
| 60 | |
| 61 | mux.HandleFunc("/applications/id/token", func(w http.ResponseWriter, r *http.Request) { |
| 62 | testMethod(t, r, "PATCH") |
| 63 | testJSONBody(t, r, struct { |
| 64 | AccessToken string `json:"access_token"` |
| 65 | }{ |
| 66 | AccessToken: "a", |
| 67 | }) |
| 68 | testHeader(t, r, "Accept", mediaTypeOAuthAppPreview) |
| 69 | fmt.Fprint(w, `{"ID":1}`) |
| 70 | }) |
| 71 | |
| 72 | ctx := t.Context() |
| 73 | got, _, err := client.Authorizations.Reset(ctx, "id", "a") |
| 74 | if err != nil { |
| 75 | t.Errorf("Authorizations.Reset returned error: %v", err) |
| 76 | } |
| 77 | |
| 78 | want := &Authorization{ID: Ptr(int64(1))} |
| 79 | if !cmp.Equal(got, want) { |
| 80 | t.Errorf("Authorizations.Reset returned auth %+v, want %+v", got, want) |
| 81 | } |
| 82 | |
| 83 | const methodName = "Reset" |
| 84 | testBadOptions(t, methodName, func() (err error) { |
| 85 | _, _, err = client.Authorizations.Reset(ctx, "\n", "\n") |
| 86 | return err |
| 87 | }) |
| 88 | |
| 89 | testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { |
| 90 | got, resp, err := client.Authorizations.Reset(ctx, "id", "a") |
| 91 | if got != nil { |
| 92 | t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) |
| 93 | } |
| 94 | return resp, err |
| 95 | }) |
| 96 | } |
| 97 | |
| 98 | func TestAuthorizationsService_Revoke(t *testing.T) { |
| 99 | t.Parallel() |
nothing calls this directly
no test coverage detected
searching dependent graphs…