mirror of
https://github.com/ansible/awx.git
synced 2026-01-12 18:40:01 -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:
parent
c89a549cbd
commit
453772f62c
@ -384,7 +384,7 @@ class BaseJobTestMixin(BaseTestMixin):
|
||||
password='Heading0',
|
||||
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(
|
||||
username='testers',
|
||||
|
||||
@ -281,11 +281,17 @@ class JobTemplateTest(BaseJobTestMixin, django.test.TransactionTestCase):
|
||||
self.assertFalse('south' in [x['username'] for x in all_credentials['results']])
|
||||
|
||||
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
|
||||
with self.current_user(self.user_sue):
|
||||
# Greg shouldn't be able to see the north credential once deleting its team
|
||||
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)
|
||||
all_credentials = self.get(url, expect=200)
|
||||
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):
|
||||
self.skipTest('This test makes assumptions about projects being multi-org and needs to be updated/rewritten')
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user