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

Function TestAuthorizationsService_Reset

github/authorizations_test.go:57–96  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

55}
56
57func 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
98func TestAuthorizationsService_Revoke(t *testing.T) {
99 t.Parallel()

Callers

nothing calls this directly

Calls 9

testMethodFunction · 0.85
testJSONBodyFunction · 0.85
testHeaderFunction · 0.85
testBadOptionsFunction · 0.85
ResetMethod · 0.80
EqualMethod · 0.80
setupFunction · 0.70
PtrFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…