MCPcopy
hub / github.com/gofiber/fiber / Test_SessionManager_DelRaw_StoreError

Function Test_SessionManager_DelRaw_StoreError

middleware/csrf/csrf_test.go:2968–2986  ·  view source on GitHub ↗

Test_SessionManager_DelRaw_StoreError covers the error branch when the session store cannot be loaded during delRaw.

(t *testing.T)

Source from the content-addressed store, hash-verified

2966// Test_SessionManager_DelRaw_StoreError covers the error branch when the session
2967// store cannot be loaded during delRaw.
2968func Test_SessionManager_DelRaw_StoreError(t *testing.T) {
2969 t.Parallel()
2970
2971 storage := newFlakySessionStorage()
2972 storage.failGet = true
2973 store := session.NewStore(session.Config{
2974 Storage: storage,
2975 Extractor: extractors.FromCookie("session_id"),
2976 })
2977 m := newSessionManager(store)
2978
2979 app := fiber.New()
2980 c := newSessionCtx(app, "abc")
2981 defer app.ReleaseCtx(c)
2982
2983 require.NotPanics(t, func() {
2984 m.delRaw(c)
2985 })
2986}
2987
2988// Test_SessionManager_DelRaw_SaveError covers the save-failure warning branch of
2989// delRaw.

Callers

nothing calls this directly

Calls 8

NewStoreFunction · 0.92
FromCookieFunction · 0.92
newFlakySessionStorageFunction · 0.85
newSessionManagerFunction · 0.85
newSessionCtxFunction · 0.85
ReleaseCtxMethod · 0.80
NewMethod · 0.65
delRawMethod · 0.45

Tested by

no test coverage detected