Пример #1
0
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)
Пример #2
0
def test_sync_token_invalid():
    client = _setup()
    with pytest.raises(bosdyn.client.InvalidTokenError):
        token = client.auth_with_token('not-a-valid-token')
Пример #3
0
def test_sync_token_valid():
    client = _setup()
    token = client.auth_with_token(MockAuthServicer.TOKEN_TO_REMINT)
    assert MockAuthServicer.RETURN_TOKEN == token
Пример #4
0
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)
Пример #5
0
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)
Пример #6
0
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)
Пример #7
0
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