Пример #1
0
def test_async_token_timeout():
    timeout = 0.1
    client = _setup(rpc_delay=(timeout * 2))
    fut = client.auth_with_token_async(MockAuthServicer.TOKEN_TO_REMINT,
                                       timeout=timeout)
    with pytest.raises(TimedOutError):
        fut.result()
Пример #2
0
def test_async_token_invalid():
    client = _setup()
    fut = client.auth_with_token_async('not-a-valid-token')
    with pytest.raises(bosdyn.client.InvalidTokenError):
        fut.result()
Пример #3
0
def test_async_token_valid():
    client = _setup()
    fut = client.auth_with_token_async(MockAuthServicer.TOKEN_TO_REMINT)
    assert MockAuthServicer.RETURN_TOKEN == fut.result()
Пример #4
0
def test_async_token_invalid_app_token():
    client, service, server = _setup(use_app_token=True)
    fut = client.auth_with_token_async(MockAuthServicer.TOKEN_TO_REMINT,
                                       MockAuthServicer.INVALID_APP_TEST_TOKEN)
    with pytest.raises(bosdyn.client.InvalidApplicationTokenError):
        fut.result()
Пример #5
0
def test_async_token_expired_app_token():
    client, service, server = _setup()
    fut = client.auth_with_token_async(MockAuthServicer.TOKEN_TO_REMINT,
                                       MockAuthServicer.EXPIRED_APP_TEST_TOKEN)
    with pytest.raises(bosdyn.client.ExpiredApplicationTokenError):
        fut.result()
Пример #6
0
def test_async_token_invalid():
    client, service, server = _setup()
    fut = client.auth_with_token_async('not-a-valid-token',
                                       MockAuthServicer.VALID_APP_TEST_TOKEN)
    with pytest.raises(bosdyn.client.InvalidTokenError):
        fut.result()
Пример #7
0
def test_async_token_valid():
    client, service, server = _setup()
    fut = client.auth_with_token_async(MockAuthServicer.TOKEN_TO_REMINT,
                                       MockAuthServicer.VALID_APP_TEST_TOKEN)
    assert MockAuthServicer.RETURN_TOKEN == fut.result()