def test_round_robin_loops_back(): resolver = Resolver() first_ip = resolver.resolve("yahoo.com").ip current = None length = 0 while first_ip != current: length += 1 current = resolver.resolve("yahoo.com").ip assert length > 1
def test_resolver(): resolver = Resolver() answer = resolver.resolve("google.com.ar") assert answer.domain == "google.com.ar"
def test_cname_is_ignored(): resolver = Resolver() first_answer = resolver.resolve("productforums.google.com") assert legal_ip_address(first_answer.ip)
def test_round_robin(): resolver = Resolver() first_answer = resolver.resolve("yahoo.com") second_answer = resolver.resolve("yahoo.com") assert first_answer.ip != second_answer.ip
def test_domain_parsing_returns_an_ip(): resolver = Resolver() answer = resolver.resolve("yahoo.com") assert legal_ip_address(answer.ip)
def test_resolver_domain_is_not_custom(): resolver = Resolver() answer = resolver.resolve("google.com.ar") assert answer.custom is False
def custom_domain(): return Resolver.get_instance().save_custom_domain("distro.tp1.com", "1.1.1.1")
def reset_resolver(): yield Resolver.get_instance().custom_domains = {}