MCPcopy Create free account
hub / github.com/TheSecuredAnalyst/security-suite / test_cache_expiration

Method test_cache_expiration

tests/test_cache.py:73–92  ·  view source on GitHub ↗

Test cache entries expire correctly.

(self, temp_cache, sample_result)

Source from the content-addressed store, hash-verified

71 assert checksum1 == checksum2
72
73 def test_cache_expiration(self, temp_cache, sample_result):
74 """Test cache entries expire correctly."""
75 # Create cache with very short TTL
76 short_cache = ScanCache(ttl_seconds=1)
77 short_cache.cache_dir = temp_cache.cache_dir
78
79 target = "example.com"
80 modules = ["osint"]
81
82 short_cache.set(target, modules, sample_result)
83
84 # Should be available immediately
85 assert short_cache.get(target, modules) is not None
86
87 # Wait for expiration
88 import time
89 time.sleep(2)
90
91 # Should be expired
92 assert short_cache.get(target, modules) is None
93
94 def test_cache_clear_all(self, temp_cache, sample_result):
95 """Test clearing all cache entries."""

Callers

nothing calls this directly

Calls 3

setMethod · 0.95
getMethod · 0.95
ScanCacheClass · 0.90

Tested by

no test coverage detected