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:
Akita Noek 2016-03-24 21:16:15 -04:00
parent c89a549cbd
commit 453772f62c
2 changed files with 9 additions and 3 deletions

View File

@ -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',

View File

@ -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')