From ec505f3f6016dc6ed144b01275cf1d44312cd12f Mon Sep 17 00:00:00 2001 From: Wayne Witzel III Date: Wed, 25 May 2016 11:40:30 -0400 Subject: [PATCH] adjusting test and renaming helper --- awx/main/tests/factories/tower.py | 10 +++++----- awx/main/tests/functional/test_projects.py | 7 ------- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/awx/main/tests/factories/tower.py b/awx/main/tests/factories/tower.py index bf0311d58b..2a9d493efe 100644 --- a/awx/main/tests/factories/tower.py +++ b/awx/main/tests/factories/tower.py @@ -27,8 +27,8 @@ from .fixtures import ( from .exc import NotUnique -def build_role_objects(objects): - '''build_role_objects assembles a dictionary of all possible objects by name. +def generate_role_objects(objects): + '''generate_role_objects assembles a dictionary of all possible objects by name. It will raise an exception if any of the objects share a name due to the fact that it is to be used with apply_roles, which expects unique object names. @@ -201,7 +201,7 @@ def create_job_template(name, **kwargs): inventory=inv, credential=cred, job_type=job_type, persisted=persisted) - role_objects = build_role_objects([org, proj, inv, cred]) + role_objects = generate_role_objects([org, proj, inv, cred]) apply_roles(kwargs.get('roles'), role_objects, persisted) return Objects(job_template=jt, @@ -245,7 +245,7 @@ def create_organization(name, **kwargs): else: notification_templates[nt] = mk_notification_template(nt, organization=org, persisted=persisted) - role_objects = build_role_objects([org, superusers, users, teams, projects, labels, notification_templates]) + role_objects = generate_role_objects([org, superusers, users, teams, projects, labels, notification_templates]) apply_roles(kwargs.get('roles'), role_objects, persisted) return Objects(organization=org, superusers=_Mapped(superusers), @@ -271,7 +271,7 @@ def create_notification_template(name, **kwargs): superusers = generate_users(organization, teams, True, persisted, superusers=kwargs.get('superusers')) users = generate_users(organization, teams, False, persisted, users=kwargs.get('users')) - role_objects = build_role_objects([organization, notification_template]) + role_objects = generate_role_objects([organization, notification_template]) apply_roles(kwargs.get('roles'), role_objects, persisted) return Objects(notification_template=notification_template, organization=organization, diff --git a/awx/main/tests/functional/test_projects.py b/awx/main/tests/functional/test_projects.py index 902ffa75d0..4c32d1dd69 100644 --- a/awx/main/tests/functional/test_projects.py +++ b/awx/main/tests/functional/test_projects.py @@ -1,7 +1,6 @@ import mock # noqa import pytest -from django.db import transaction from django.core.urlresolvers import reverse from awx.main.models import Project @@ -71,12 +70,6 @@ def test_team_project_list(get, team_project_list): assert get(reverse('api:team_projects_list', args=(team2.pk,)), alice).data['count'] == 1 team2.read_role.members.remove(alice) - # Test user endpoints first, very similar tests to test_user_project_list - # but permissions are being derived from team membership instead. - with transaction.atomic(): - res = get(reverse('api:user_projects_list', args=(bob.pk,)), alice) - assert res.status_code == 403 - # admins can see all projects assert get(reverse('api:user_projects_list', args=(admin.pk,)), admin).data['count'] == 3