def test_edit_user_convert_to_superuser(data): username = actions.random_str() users.create_new_user(username, '123456', '*****@*****.**') response = users.get_user(username) assert response.json()['is_superuser'] is False users.edit_user(username, new_is_superuser=True) response = users.get_user(username) assert response.json()['is_superuser'] is True
def test(data): new_username = actions.random_str() users.edit_user(data.username, new_username=new_username) response = users.get_user(new_username) assert response.json()['username'] == new_username assert response.json()['email'] == '*****@*****.**' users.edit_user(new_username, new_email='*****@*****.**') response = users.get_user(new_username) assert response.json()['username'] == new_username assert response.json()['email'] == '*****@*****.**'
def test_delete_user(data): username = actions.random_str() users.create_new_user(username, '123456', '*****@*****.**') response = users.delete_user(username) assert response.status_code == 200 assert response.json() == {'errors': []} response = users.get_user(username) assert response.json() is None
def test_get_user(data): project.using_project('general') standard = user_factory.create_user_if('general__standard') response = users.get_user(standard['username']) assert response.status_code == 200 assert response.json()['projects'] == {'general': 'standard'} assert response.json()['username'] == standard['username'] assert response.json()['email'] is None assert response.json()['is_superuser'] is False
def test(data): new_username = actions.random_str() new_email = '*****@*****.**' new_project_permissions = [{'project': "projectname", 'permission': "admin"}] response = users.edit_user(data.username, new_username, new_email, False, new_project_permissions) assert response.status_code == 200 response = users.get_user(new_username) assert response.json()['username'] == new_username assert response.json()['email'] == new_email assert response.json()['is_superuser'] is False assert response.json()['projects'] == {'projectname': 'admin'}
def test_new_superuser(data): username = actions.random_str() password = actions.random_str() is_superuser = True project_permissions = [] response = users.create_new_user(username, password, '', is_superuser, project_permissions) assert response.status_code == 200 response = users.get_user(username) assert response.json()['username'] == username assert response.json()['email'] is None assert response.json()['is_superuser'] is True assert response.json()['projects'] == {}
def test_new_user_with_project_permissions(data): username = actions.random_str() password = '******' is_superuser = False project_permissions = [{'project': "projectname", 'permission': "admin"}] response = users.create_new_user(username, password, '', is_superuser, project_permissions) assert response.status_code == 200 assert response.json() == [] response = users.get_user(username) assert response.json()['username'] == username assert response.json()['email'] is None assert response.json()['is_superuser'] is False assert response.json()['projects'] == {'projectname': 'admin'}
def user_exists(username): response = users.get_user(username) return response.json() is not None
def test(data): response = users.delete_user(data.username) assert response.status_code == 200 assert response.json() == {'errors': []} response = users.get_user(data.username) assert response.json() is None
def test(data): response = users.get_user(data.username) assert response.json()['is_superuser'] is False users.edit_user(data.username, new_is_superuser=True) response = users.get_user(data.username) assert response.json()['is_superuser'] is True