MCPcopy Create free account
hub / github.com/devfeel/dotweb / TestSesionConfig

Function TestSesionConfig

server_test.go:26–48  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

24}
25
26func TestSesionConfig(t *testing.T) {
27 server := NewHttpServer()
28 server.DotApp = New()
29 // use default config
30 server.SetSessionConfig(session.NewDefaultRuntimeConfig())
31
32 // init
33 server.InitSessionManager()
34
35 // get session
36 sessionManager := server.GetSessionManager()
37
38 // EnabledSession flag is false
39 test.Nil(t, sessionManager)
40
41 // switch EnabledSession flag
42 server.SessionConfig().EnabledSession = true
43 sessionManager = server.GetSessionManager()
44
45 test.NotNil(t, sessionManager)
46 test.Equal(t, server.sessionManager.StoreConfig().CookieName, session.DefaultSessionCookieName)
47 test.Equal(t, server.sessionManager.GCLifetime, int64(session.DefaultSessionGCLifeTime))
48}
49
50func Index(ctx Context) error {
51 ctx.Response().Header().Set("Content-Type", "text/html; charset=utf-8")

Callers

nothing calls this directly

Calls 11

SetSessionConfigMethod · 0.95
InitSessionManagerMethod · 0.95
GetSessionManagerMethod · 0.95
SessionConfigMethod · 0.95
NewDefaultRuntimeConfigFunction · 0.92
NilFunction · 0.92
NotNilFunction · 0.92
EqualFunction · 0.92
NewHttpServerFunction · 0.85
NewFunction · 0.85
StoreConfigMethod · 0.80

Tested by

no test coverage detected