Test cache entries expire correctly.
(self, temp_cache, sample_result)
| 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.""" |