コード例 #1
0
def test_no_timeout_locate_ns_not_existing():
    """
    Locating a NS that does not exist with no timeout should raise an error.
    """
    t0 = time.time()
    with pytest.raises(TimeoutError):
        locate_ns('127.0.0.1:22', timeout=0.)
    assert time.time() - t0 <= 1.
コード例 #2
0
def test_wrong_nameserver_address():
    """
    Locating a name server that does not exist should raise an error.
    """
    t0 = time.time()
    with pytest.raises(TimeoutError):
        locate_ns('127.0.0.1:22', timeout=1.)
    assert 1. <= time.time() - t0 <= 2.
コード例 #3
0
ファイル: test_proxy.py プロジェクト: sgaist/osbrain
def test_wrong_nameserver_address(timeout):
    """
    Locating a name server that does not exist should raise an error after
    the defined timeout.
    """
    t0 = time.time()
    with pytest.raises(TimeoutError):
        locate_ns('127.0.0.1:1234', timeout=timeout)
    assert timeout <= time.time() - t0 <= timeout + 1.2
コード例 #4
0
ファイル: test_proxy.py プロジェクト: Peque/osbrain
def test_wrong_nameserver_address(timeout):
    """
    Locating a name server that does not exist should raise an error after
    the defined timeout.
    """
    t0 = time.time()
    with pytest.raises(TimeoutError):
        locate_ns('127.0.0.1:1234', timeout=timeout)
    assert timeout <= time.time() - t0 <= timeout + 1.2
コード例 #5
0
ファイル: test_proxy.py プロジェクト: sgaist/osbrain
def test_no_timeout_locate_ns_existing(nsproxy):
    """
    Locating a NS that exists with no timeout should be OK.
    """
    locate_ns(nsproxy.addr(), timeout=0.0)
コード例 #6
0
ファイル: test_proxy.py プロジェクト: Peque/osbrain
def test_no_timeout_locate_ns_existing(nsproxy):
    """
    Locating a NS that exists with no timeout should be OK.
    """
    locate_ns(nsproxy.addr(), timeout=0.)