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

Function TestRandomState

internal/oauth/oauth_test.go:52–64  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

50}
51
52func TestRandomState(t *testing.T) {
53 s1, err := randomState()
54 require.NoError(t, err)
55 s2, err := randomState()
56 require.NoError(t, err)
57
58 assert.NotEqual(t, s1, s2, "state must be unique per call")
59 assert.NotContains(t, s1, "=", "state must be URL-safe without padding")
60 assert.NotContains(t, s1, "+")
61 assert.NotContains(t, s1, "/")
62 assert.GreaterOrEqual(t, len(s1), 22, "16 random bytes encode to 22 base64url chars")
63 assert.False(t, strings.ContainsAny(s1, " \t\n"))
64}

Callers

nothing calls this directly

Calls 1

randomStateFunction · 0.85

Tested by

no test coverage detected