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