def test_create_user(session_browser): """Test creating a user.""" if functional.user_exists(session_browser, 'alice'): functional.delete_user(session_browser, 'alice') functional.create_user(session_browser, 'alice') assert functional.user_exists(session_browser, 'alice')
def test_rename_user(session_browser): """Test renaming a user.""" _non_admin_user_exists(session_browser, 'alice') if functional.user_exists(session_browser, 'bob'): functional.delete_user(session_browser, 'bob') _rename_user(session_browser, 'alice', 'bob') assert not functional.user_exists(session_browser, 'alice') assert functional.user_exists(session_browser, 'bob')
def delete_user(session_browser, name): functional.delete_user(session_browser, name)
def user_does_not_exist(session_browser, name): if functional.user_exists(session_browser, name): functional.delete_user(session_browser, name)
def admin_user_exists(session_browser, name): if functional.user_exists(session_browser, name): functional.delete_user(session_browser, name) functional.create_user(session_browser, name, groups=['admin'])
def _non_admin_user_exists(session_browser, name): if functional.user_exists(session_browser, name): functional.delete_user(session_browser, name) functional.create_user(session_browser, name)
def test_delete_user(session_browser): """Test deleting a user.""" _non_admin_user_exists(session_browser, 'alice') functional.delete_user(session_browser, 'alice') assert not functional.user_exists(session_browser, 'alice')
def user_in_group_exists(session_browser, name, group): if functional.user_exists(session_browser, name): functional.delete_user(session_browser, name) functional.create_user(session_browser, name, groups=[group])