Example #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()
Example #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()
Example #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()
Example #4
0
def test_async_invalid():
    client = _setup()
    with pytest.raises(bosdyn.client.InvalidLoginError):
        client.auth_async('parrot', '').result()
Example #5
0
def test_async_valid():
    client = _setup()
    fut = client.auth_async(MockAuthServicer.USERNAME,
                            MockAuthServicer.PASSWORD)
    assert MockAuthServicer.RETURN_TOKEN == fut.result()
Example #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()
Example #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()