MCPcopy
hub / github.com/oauth2-proxy/oauth2-proxy / TestStateEncodesCorrectly

Function TestStateEncodesCorrectly

oauthproxy_test.go:3589–3598  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

3587}
3588
3589func TestStateEncodesCorrectly(t *testing.T) {
3590 state := "some_state_to_test"
3591 nonce := "some_nonce_to_test"
3592
3593 encodedResult := encodeState(nonce, state, true)
3594 assert.Equal(t, "c29tZV9ub25jZV90b190ZXN0OnNvbWVfc3RhdGVfdG9fdGVzdA", encodedResult)
3595
3596 notEncodedResult := encodeState(nonce, state, false)
3597 assert.Equal(t, "some_nonce_to_test:some_state_to_test", notEncodedResult)
3598}
3599
3600func TestStateDecodesCorrectly(t *testing.T) {
3601 nonce, redirect, _ := decodeState("c29tZV9ub25jZV90b190ZXN0OnNvbWVfc3RhdGVfdG9fdGVzdA", true)

Callers

nothing calls this directly

Calls 1

encodeStateFunction · 0.85

Tested by

no test coverage detected