Пример #1
0
def test_as_dict():
    """Assert that the User is rendered correctly as a dict."""
    user = services.User()
    user.username = '******'
    user.roles = '{edit,uma_authorization,basic}'

    assert user.asdict() == {
        'username': '******',
        'roles': '{edit,uma_authorization,basic}'
    }
Пример #2
0
def test_user_find_by_username_missing_username(session):
    """Assert that the business can be found by name."""
    username = '******'
    user = services.User()
    user.roles = '{edit,uma_authorization,basic}'
    user.username = username
    user.save()

    user = services.User.find_by_username(None)

    assert user is None
Пример #3
0
def test_user_saved_from_new(session):
    """Assert that the business is saved to the cache."""
    username = '******'
    user = services.User()
    user.username = username
    user.roles = '{edit,uma_authorization,basic}'
    user.save()

    user = services.User.find_by_username(username)

    assert user is not None
Пример #4
0
def test_user_find_by_username_missing_username(session):  # pylint: disable=unused-argument
    """Assert that the business can be found by name."""
    username = '******'
    user = services.User()
    user.roles = '{edit,uma_authorization,basic}'
    user.username = username
    user.keycloak_guid = '1b20db59-19a0-4727-affe-c6f64309fd04'
    user.save()

    user = services.User.find_by_username(None)

    assert user is None
Пример #5
0
def test_user_saved_from_new(session):  # pylint: disable=unused-argument
    """Assert that the business is saved to the cache."""
    username = '******'
    user = services.User()
    user.username = username
    user.roles = '{edit,uma_authorization,basic}'
    user.keycloak_guid = '1b20db59-19a0-4727-affe-c6f64309fd04'
    user.save()

    user = services.User.find_by_username(username)

    assert user is not None