CLOUDSTACK-7684: Fixed Exception not raised issue in secondary storage limits test suite test_ss_max_limits.py
Signed-off-by: SrikanteswaraRao Talluri <tall...@apache.org> Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/1f7ffb26 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/1f7ffb26 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/1f7ffb26 Branch: refs/heads/master Commit: 1f7ffb26180969205ae66dddd83f965178a97d70 Parents: bf7ce74 Author: Gaurav Aradhye <gaurav.arad...@clogeny.com> Authored: Wed Oct 8 11:57:45 2014 +0530 Committer: SrikanteswaraRao Talluri <tall...@apache.org> Committed: Tue Nov 4 11:52:41 2014 +0530 ---------------------------------------------------------------------- test/integration/component/test_ss_max_limits.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1f7ffb26/test/integration/component/test_ss_max_limits.py ---------------------------------------------------------------------- diff --git a/test/integration/component/test_ss_max_limits.py b/test/integration/component/test_ss_max_limits.py index ba886e8..49a1e4f 100644 --- a/test/integration/component/test_ss_max_limits.py +++ b/test/integration/component/test_ss_max_limits.py @@ -101,7 +101,7 @@ class TestMaxSecondaryStorageLimits(cloudstackTestCase): self.services["template_2"]["hypervisor"] = builtin_info[1] self.services["template_2"]["format"] = builtin_info[2] - template = Template.register(self.apiclient, + template = Template.register(self.userapiclient, self.services["template_2"], zoneid=self.zone.id, account=self.child_do_admin.name if not inProject else None, @@ -110,7 +110,7 @@ class TestMaxSecondaryStorageLimits(cloudstackTestCase): template.download(self.apiclient) - templates = Template.list(self.apiclient, + templates = Template.list(self.userapiclient, templatefilter=\ self.services["template_2"]["templatefilter"], id=template.id) @@ -131,6 +131,10 @@ class TestMaxSecondaryStorageLimits(cloudstackTestCase): self.child_do_admin = Account.create(self.apiclient, self.services["account"], admin=True, domainid=self.child_domain.id) + self.userapiclient = self.testClient.getUserApiClient( + UserName=self.child_do_admin.name, + DomainName=self.child_do_admin.domain) + # Create project as a domain admin self.project = Project.create(self.apiclient, self.services["project"], account=self.child_do_admin.name, @@ -195,11 +199,12 @@ class TestMaxSecondaryStorageLimits(cloudstackTestCase): self.assertEqual(response[0], PASS, response[1]) with self.assertRaises(Exception): - template = Template.register(self.apiclient, + template = Template.register(self.userapiclient, self.services["template_2"], zoneid=self.zone.id, account=self.child_do_admin.name, domainid=self.child_do_admin.domainid) + template.delete(self.userapiclient) return @attr(tags=["advanced"], required_hardware="false") @@ -231,11 +236,12 @@ class TestMaxSecondaryStorageLimits(cloudstackTestCase): self.assertEqual(response[0], PASS, response[1]) with self.assertRaises(Exception): - template = Template.register(self.apiclient, + template = Template.register(self.userapiclient, self.services["template_2"], zoneid=self.zone.id, account=self.child_do_admin.name, domainid=self.child_do_admin.domainid) + template.delete(self.userapiclient) return @attr(tags=["advanced"], required_hardware="false") @@ -256,7 +262,7 @@ class TestMaxSecondaryStorageLimits(cloudstackTestCase): self.assertEqual(response[0], PASS, response[1]) try: - projects = Project.list(self.apiclient, id=self.project.id, listall=True) + projects = Project.list(self.userapiclient, id=self.project.id, listall=True) except Exception as e: self.fail("failed to get projects list: %s" % e) @@ -272,8 +278,9 @@ class TestMaxSecondaryStorageLimits(cloudstackTestCase): self.assertEqual(response[0], PASS, response[1]) with self.assertRaises(Exception): - template = Template.register(self.apiclient, + template = Template.register(self.userapiclient, self.services["template_2"], zoneid=self.zone.id, projectid=self.project.id) + template.delete(self.userapiclient) return