Ejemplo n.º 1
0
def test_async_invalid_app_token():
    client, service, server = _setup(use_app_token=True)
    fut = client.auth_async(MockAuthServicer.USERNAME,
                            MockAuthServicer.PASSWORD,
                            MockAuthServicer.INVALID_APP_TEST_TOKEN)
    with pytest.raises(bosdyn.client.InvalidApplicationTokenError):
        fut.result()
Ejemplo n.º 2
0
def test_async_expired_app_token():
    client, service, server = _setup()
    fut = client.auth_async(MockAuthServicer.USERNAME,
                            MockAuthServicer.PASSWORD,
                            MockAuthServicer.EXPIRED_APP_TEST_TOKEN)
    with pytest.raises(bosdyn.client.ExpiredApplicationTokenError):
        fut.result()
Ejemplo n.º 3
0
def test_async_timeout():
    timeout = 0.1
    client = _setup(rpc_delay=(timeout * 2))
    fut = client.auth_async(MockAuthServicer.USERNAME,
                            MockAuthServicer.PASSWORD,
                            timeout=timeout)
    with pytest.raises(TimedOutError):
        fut.result()
Ejemplo n.º 4
0
def test_async_invalid():
    client = _setup()
    with pytest.raises(bosdyn.client.InvalidLoginError):
        client.auth_async('parrot', '').result()
Ejemplo n.º 5
0
def test_async_valid():
    client = _setup()
    fut = client.auth_async(MockAuthServicer.USERNAME,
                            MockAuthServicer.PASSWORD)
    assert MockAuthServicer.RETURN_TOKEN == fut.result()
Ejemplo n.º 6
0
def test_async_invalid():
    client, service, server = _setup()
    with pytest.raises(bosdyn.client.InvalidLoginError):
        client.auth_async('parrot', '',
                          MockAuthServicer.VALID_APP_TEST_TOKEN).result()
Ejemplo n.º 7
0
def test_async_valid():
    client, service, server = _setup()
    fut = client.auth_async(MockAuthServicer.USERNAME,
                            MockAuthServicer.PASSWORD,
                            MockAuthServicer.VALID_APP_TEST_TOKEN)
    assert MockAuthServicer.RETURN_TOKEN == fut.result()