Example #1
0
def test_get_user_returns_the_user(ltd_client: ListTheDocs):

    ltd_client.add_user('foo')

    user = ltd_client.get_user('foo')
    assert isinstance(user, User)
    assert user.name == 'foo'
    assert user.is_admin is False
    assert isinstance(user.api_keys, list)
    assert len(user.api_keys) == 1
    assert isinstance(user.api_keys[0].key, str)
    assert isinstance(user.api_keys[0].created_at, datetime.datetime)
    assert user.api_keys[0].is_valid is True
Example #2
0
def test_get_user_returns_none_when_user_does_not_exists(
        ltd_client: ListTheDocs):

    assert ltd_client.get_user('foo') is None