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

Function TestRuntimeStore_SessionRemove

session/store_runtime_test.go:108–140  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

106}
107
108func TestRuntimeStore_SessionRemove(t *testing.T) {
109 // Use a separate store for this test
110 testStore := NewRuntimeStore(NewDefaultRuntimeConfig())
111 testValue := make(map[interface{}]interface{})
112 testValue["foo"] = "bar"
113 testValue["kak"] = "lal"
114
115 testStore.SessionUpdate(NewSessionState(testStore, "session_read", testValue))
116
117 log.Println("session 删除测试")
118 fmt.Println("------------------------")
119 fmt.Println("before remove : ")
120 read, err := testStore.SessionRead("session_read")
121 if err != nil {
122 panic(err)
123 }
124 fmt.Println("read : ")
125 fmt.Printf("sessionid : %s , values : %v \n", read.SessionID(), read.values)
126
127 err = testStore.SessionRemove("session_read")
128 if err != nil {
129 fmt.Println(err.Error())
130 }
131
132 fmt.Println("------------------------")
133 fmt.Println("after remove : ")
134 read, err = testStore.SessionRead("session_read")
135 if err != nil {
136 panic(err)
137 }
138 fmt.Println("read : ")
139 fmt.Printf("sessionid : %s , values : %v \n", read.SessionID(), read.values)
140}
141
142func TestRuntimeStore_SessionGC(t *testing.T) {
143 // GC test - no assertions needed

Callers

nothing calls this directly

Calls 8

SessionUpdateMethod · 0.95
SessionReadMethod · 0.95
SessionRemoveMethod · 0.95
NewRuntimeStoreFunction · 0.85
NewDefaultRuntimeConfigFunction · 0.85
NewSessionStateFunction · 0.85
SessionIDMethod · 0.65
ErrorMethod · 0.65

Tested by

no test coverage detected