MCPcopy Index your code
hub / github.com/oauth2-proxy/oauth2-proxy / TestLoadCookiedSession

Function TestLoadCookiedSession

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

Source from the content-addressed store, hash-verified

927}
928
929func TestLoadCookiedSession(t *testing.T) {
930 pcTest, err := NewProcessCookieTestWithDefaults()
931 if err != nil {
932 t.Fatal(err)
933 }
934
935 created := time.Now()
936 startSession := &sessions.SessionState{Email: "john.doe@example.com", AccessToken: "my_access_token", CreatedAt: &created}
937 err = pcTest.SaveSession(startSession)
938 assert.NoError(t, err)
939
940 session, err := pcTest.LoadCookiedSession()
941 if err != nil {
942 t.Fatal(err)
943 }
944 assert.Equal(t, startSession.Email, session.Email)
945 assert.Equal(t, "", session.User)
946 assert.Equal(t, startSession.AccessToken, session.AccessToken)
947}
948
949func TestProcessCookieNoCookieError(t *testing.T) {
950 pcTest, err := NewProcessCookieTestWithDefaults()

Callers

nothing calls this directly

Calls 3

SaveSessionMethod · 0.45
LoadCookiedSessionMethod · 0.45

Tested by

no test coverage detected