MCPcopy Create free account
hub / github.com/crewjam/saml / TestMemoryReplayCacheAlreadyExpired

Function TestMemoryReplayCacheAlreadyExpired

samlsp/replay_cache_test.go:85–93  ·  view source on GitHub ↗

An ID recorded with an expiry that has already passed takes no room.

(t *testing.T)

Source from the content-addressed store, hash-verified

83
84// An ID recorded with an expiry that has already passed takes no room.
85func TestMemoryReplayCacheAlreadyExpired(t *testing.T) {
86 now := replayCacheTestNow
87 setReplayCacheTestNow(t, &now)
88 c := NewMemoryReplayCache(1)
89
90 assert.NilError(t, c.Consume("id-1", now.Add(-time.Nanosecond)))
91 assert.Check(t, c.Consume("id-2", now.Add(time.Minute)))
92 assert.Check(t, is.Len(c.entries, 1))
93}
94
95func TestNewMemoryReplayCacheRequiresPositiveSize(t *testing.T) {
96 for _, n := range []int{0, -1} {

Callers

nothing calls this directly

Calls 4

ConsumeMethod · 0.95
setReplayCacheTestNowFunction · 0.85
NewMemoryReplayCacheFunction · 0.85
LenMethod · 0.80

Tested by

no test coverage detected