예제 #1
0
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
예제 #2
0
def test_resolver():
    resolver = Resolver()
    answer = resolver.resolve("google.com.ar")
    assert answer.domain == "google.com.ar"
예제 #3
0
def test_cname_is_ignored():
    resolver = Resolver()
    first_answer = resolver.resolve("productforums.google.com")

    assert legal_ip_address(first_answer.ip)
예제 #4
0
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
예제 #5
0
def test_domain_parsing_returns_an_ip():
    resolver = Resolver()
    answer = resolver.resolve("yahoo.com")
    assert legal_ip_address(answer.ip)
예제 #6
0
def test_resolver_domain_is_not_custom():
    resolver = Resolver()
    answer = resolver.resolve("google.com.ar")
    assert answer.custom is False
예제 #7
0
def custom_domain():
    return Resolver.get_instance().save_custom_domain("distro.tp1.com",
                                                      "1.1.1.1")
예제 #8
0
def reset_resolver():
    yield
    Resolver.get_instance().custom_domains = {}