mirror of
https://github.com/ansible/awx.git
synced 2026-03-06 03:01:06 -03:30
Fixed up credential viewability expectations in jobs_monlithic tests
Super users can now see all credentials always.. Adjusted test to test for this, as well as original test intent which was to test to ensure after removing a team which has access to a credential, members of that team no longer have access to the credential.
This commit is contained in:
@@ -384,7 +384,7 @@ class BaseJobTestMixin(BaseTestMixin):
|
|||||||
password='Heading0',
|
password='Heading0',
|
||||||
created_by = self.user_sue,
|
created_by = self.user_sue,
|
||||||
)
|
)
|
||||||
self.team_ops_north.member_role.children.add(self.cred_ops_north.usage_role)
|
self.team_ops_north.member_role.children.add(self.cred_ops_north.owner_role)
|
||||||
|
|
||||||
self.cred_ops_test = Credential.objects.create(
|
self.cred_ops_test = Credential.objects.create(
|
||||||
username='testers',
|
username='testers',
|
||||||
|
|||||||
@@ -281,11 +281,17 @@ class JobTemplateTest(BaseJobTestMixin, django.test.TransactionTestCase):
|
|||||||
self.assertFalse('south' in [x['username'] for x in all_credentials['results']])
|
self.assertFalse('south' in [x['username'] for x in all_credentials['results']])
|
||||||
|
|
||||||
url2 = reverse('api:team_detail', args=(self.team_ops_north.id,))
|
url2 = reverse('api:team_detail', args=(self.team_ops_north.id,))
|
||||||
# Sue shouldn't be able to see the north credential once deleting its team
|
# Greg shouldn't be able to see the north credential once deleting its team
|
||||||
with self.current_user(self.user_sue):
|
with self.current_user(self.user_greg):
|
||||||
|
all_credentials = self.get(url, expect=200)
|
||||||
|
self.assertTrue('north' in [x['username'] for x in all_credentials['results']])
|
||||||
self.delete(url2, expect=204)
|
self.delete(url2, expect=204)
|
||||||
all_credentials = self.get(url, expect=200)
|
all_credentials = self.get(url, expect=200)
|
||||||
self.assertFalse('north' in [x['username'] for x in all_credentials['results']])
|
self.assertFalse('north' in [x['username'] for x in all_credentials['results']])
|
||||||
|
# Sue can still see the credential, she's a super user
|
||||||
|
with self.current_user(self.user_sue):
|
||||||
|
all_credentials = self.get(url, expect=200)
|
||||||
|
self.assertTrue('north' in [x['username'] for x in all_credentials['results']])
|
||||||
|
|
||||||
def test_post_job_template_list(self):
|
def test_post_job_template_list(self):
|
||||||
self.skipTest('This test makes assumptions about projects being multi-org and needs to be updated/rewritten')
|
self.skipTest('This test makes assumptions about projects being multi-org and needs to be updated/rewritten')
|
||||||
|
|||||||
Reference in New Issue
Block a user