MCPcopy Create free account
hub / github.com/rthalley/dnspython / testCacheExpiration

Method testCacheExpiration

tests/test_resolver.py:290–302  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

288 self.assertEqual(r.nameservers, ["10.0.0.1"])
289
290 def testCacheExpiration(self):
291 with FakeTime() as fake_time:
292 message = dns.message.from_text(message_text)
293 name = dns.name.from_text("example.")
294 answer = dns.resolver.Answer(
295 name, dns.rdatatype.A, dns.rdataclass.IN, message
296 )
297 cache = dns.resolver.Cache()
298 cache.put((name, dns.rdatatype.A, dns.rdataclass.IN), answer)
299 fake_time.sleep(2)
300 self.assertTrue(
301 cache.get((name, dns.rdatatype.A, dns.rdataclass.IN)) is None
302 )
303
304 def testCacheCleaning(self):
305 with FakeTime() as fake_time:

Callers

nothing calls this directly

Calls 5

putMethod · 0.95
getMethod · 0.95
FakeTimeClass · 0.85
from_textMethod · 0.45
sleepMethod · 0.45

Tested by

no test coverage detected