MCPcopy Index your code
hub / github.com/github/github-mcp-server / TestAuthenticatePKCEViaBrowser

Function TestAuthenticatePKCEViaBrowser

internal/oauth/manager_test.go:32–51  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

30}
31
32func TestAuthenticatePKCEViaBrowser(t *testing.T) {
33 f := newFakeGitHub(t)
34 m := newManager(t, f)
35
36 ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
37 defer cancel()
38
39 out, err := m.Authenticate(ctx, nil)
40 require.NoError(t, err)
41 assert.Nil(t, out, "browser flow completes without a user action")
42 assert.Equal(t, "gho_access", m.AccessToken())
43
44 // PKCE must have been exercised end to end.
45 f.mu.Lock()
46 defer f.mu.Unlock()
47 assert.Equal(t, "S256", f.codeChallengeMethod)
48 assert.NotEmpty(t, f.codeChallenge, "authorize must receive a code_challenge")
49 assert.NotEmpty(t, f.codeVerifier, "token exchange must send a code_verifier")
50 assert.Equal(t, []string{"authorization_code"}, f.grants)
51}
52
53func TestAuthenticateRefreshesExpiringGitHubAppToken(t *testing.T) {
54 f := newFakeGitHub(t)

Callers

nothing calls this directly

Calls 4

newFakeGitHubFunction · 0.85
newManagerFunction · 0.85
AccessTokenMethod · 0.80
AuthenticateMethod · 0.65

Tested by

no test coverage detected