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