Skip to content

Commit

Permalink
Remove conditional assertion
Browse files Browse the repository at this point in the history
  • Loading branch information
chrismeyersfsu authored and TheRealHaoLiu committed Jul 1, 2024
1 parent f053796 commit f3f8d55
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions awx/main/tests/functional/test_rbac_job_templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,14 @@ def test_job_template_creator_access(project, organization, rando, post, setup_m

@pytest.mark.django_db
@pytest.mark.job_permissions
@pytest.mark.parametrize('lacking', ['project', 'inventory'])
def test_job_template_insufficient_creator_permissions(lacking, project, inventory, organization, rando, post):
@pytest.mark.parametrize(
'lacking,reason',
[
('project', 'You do not have use permission on Project'),
('inventory', 'You do not have use permission on Inventory'),
],
)
def test_job_template_insufficient_creator_permissions(lacking, reason, project, inventory, organization, rando, post):
if lacking != 'project':
project.use_role.members.add(rando)
else:
Expand All @@ -198,10 +204,7 @@ def test_job_template_insufficient_creator_permissions(lacking, project, invento
user=rando,
expect=403,
)
if lacking == 'project':
assert 'You do not have use permission on Project' in response.data['project']
if lacking == 'inventory':
assert 'You do not have use permission on Inventory' in response.data['inventory']
assert reason in response.data[lacking]


@pytest.mark.django_db
Expand Down

0 comments on commit f3f8d55

Please sign in to comment.