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

Function Test_SessionManager_GetRaw_StoreError

middleware/csrf/csrf_test.go:2903–2919  ·  view source on GitHub ↗

Test_SessionManager_GetRaw_StoreError covers the error branch when loading the session from the store fails.

(t *testing.T)

Source from the content-addressed store, hash-verified

2901// Test_SessionManager_GetRaw_StoreError covers the error branch when loading the
2902// session from the store fails.
2903func Test_SessionManager_GetRaw_StoreError(t *testing.T) {
2904 t.Parallel()
2905
2906 storage := newFlakySessionStorage()
2907 storage.failGet = true
2908 store := session.NewStore(session.Config{
2909 Storage: storage,
2910 Extractor: extractors.FromCookie("session_id"),
2911 })
2912 m := newSessionManager(store)
2913
2914 app := fiber.New()
2915 c := newSessionCtx(app, "abc")
2916 defer app.ReleaseCtx(c)
2917
2918 require.Nil(t, m.getRaw(c, "key", dummyValue))
2919}
2920
2921// Test_SessionManager_SetRaw_StoreError covers the error branch when the session
2922// store cannot be loaded during setRaw.

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
getRawMethod · 0.45

Tested by

no test coverage detected