def test_sync_token_timeout(): timeout = 0.1 client, service, server = _setup(rpc_delay=(timeout * 2)) with pytest.raises(TimedOutError): token = client.auth_with_token(MockAuthServicer.TOKEN_TO_REMINT, MockAuthServicer.VALID_APP_TEST_TOKEN, timeout=timeout)
def test_sync_token_invalid(): client = _setup() with pytest.raises(bosdyn.client.InvalidTokenError): token = client.auth_with_token('not-a-valid-token')
def test_sync_token_valid(): client = _setup() token = client.auth_with_token(MockAuthServicer.TOKEN_TO_REMINT) assert MockAuthServicer.RETURN_TOKEN == token
def test_sync_token_invalid_app_token(): client, service, server = _setup(use_app_token=True) with pytest.raises(bosdyn.client.InvalidApplicationTokenError): client.auth_with_token(MockAuthServicer.TOKEN_TO_REMINT, MockAuthServicer.INVALID_APP_TEST_TOKEN)
def test_sync_token_expired_app_token(): client, service, server = _setup(use_app_token=True) with pytest.raises(bosdyn.client.ExpiredApplicationTokenError): client.auth_with_token(MockAuthServicer.TOKEN_TO_REMINT, MockAuthServicer.EXPIRED_APP_TEST_TOKEN)
def test_sync_token_invalid(): client, service, server = _setup() with pytest.raises(bosdyn.client.InvalidTokenError): token = client.auth_with_token('not-a-valid-token', MockAuthServicer.VALID_APP_TEST_TOKEN)
def test_sync_token_valid(): client, service, server = _setup() token = client.auth_with_token(MockAuthServicer.TOKEN_TO_REMINT, MockAuthServicer.VALID_APP_TEST_TOKEN) assert MockAuthServicer.RETURN_TOKEN == token