You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ta...@apache.org on 2014/11/04 07:31:19 UTC

[03/11] git commit: updated refs/heads/master to 8b636bd

CLOUDSTACK-7691: Fixed 'Exception not raised' issue in test_project_limits.py

Signed-off-by: SrikanteswaraRao Talluri <ta...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/bf7ce74c
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/bf7ce74c
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/bf7ce74c

Branch: refs/heads/master
Commit: bf7ce74c9367c6889b87233e28c33243a65353c8
Parents: 5d37f37
Author: Gaurav Aradhye <ga...@clogeny.com>
Authored: Thu Oct 9 14:56:34 2014 +0530
Committer: SrikanteswaraRao Talluri <ta...@apache.org>
Committed: Tue Nov 4 11:52:03 2014 +0530

----------------------------------------------------------------------
 .../component/test_project_limits.py            | 51 ++++++++++++++------
 1 file changed, 37 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/bf7ce74c/test/integration/component/test_project_limits.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_project_limits.py b/test/integration/component/test_project_limits.py
index 5f33ad8..5d37f0b 100644
--- a/test/integration/component/test_project_limits.py
+++ b/test/integration/component/test_project_limits.py
@@ -5,9 +5,9 @@
 # to you under the Apache License, Version 2.0 (the
 # "License"); you may not use this file except in compliance
 # with the License.  You may obtain a copy of the License at
-# 
+#
 #   http://www.apache.org/licenses/LICENSE-2.0
-# 
+#
 # Unless required by applicable law or agreed to in writing,
 # software distributed under the License is distributed on an
 # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -17,16 +17,35 @@
 """ P1 tests for Resource limits
 """
 #Import Local Modules
-import marvin
 from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import *
-from marvin.cloudstackAPI import *
-from marvin.lib.utils import *
-from marvin.lib.base import *
-from marvin.lib.common import *
+from marvin.cloudstackTestCase import cloudstackTestCase
+#from marvin.cloudstackAPI import *
+from marvin.lib.utils import (cleanup_resources,
+                              validateList)
+from marvin.lib.base import (Account,
+                             Domain,
+                             Project,
+                             Template,
+                             Snapshot,
+                             Volume,
+                             NetworkOffering,
+                             ServiceOffering,
+                             VirtualMachine,
+                             DiskOffering,
+                             Configurations,
+                             Network,
+                             PublicIPAddress)
+from marvin.lib.common import (get_domain,
+                               get_zone,
+                               get_template,
+                               list_snapshots,
+                               list_volumes,
+                               list_configurations,
+                               list_resource_limits,
+                               update_resource_limit
+                               )
 from marvin.codes import PASS
-import datetime
-
+import time
 
 class Services:
     """Test Resource Limits Services
@@ -525,6 +544,11 @@ class TestResourceLimitsProject(cloudstackTestCase):
                             cls.services["account"],
                             domainid=cls.domain.id
                             )
+
+        cls.userapiclient = cls.testClient.getUserApiClient(
+                                    UserName=cls.account.name,
+                                    DomainName=cls.account.domain)
+
         # Create project as a domain admin
         cls.project = Project.create(
                                  cls.api_client,
@@ -713,7 +737,7 @@ class TestResourceLimitsProject(cloudstackTestCase):
 
         # Exception should be raised for second Public IP
         with self.assertRaises(Exception):
-            public_ip_2 = PublicIPAddress.create(
+            PublicIPAddress.create(
                                            self.apiclient,
                                            zoneid=virtual_machine_1.zoneid,
                                            services=self.services["server"],
@@ -772,7 +796,6 @@ class TestResourceLimitsProject(cloudstackTestCase):
                         True,
                         "Check for list volume response return valid data"
                         )
-        volume = volumes[0]
 
         self.debug("Creating snapshot from volume: %s" % volumes[0].id)
         # Create a snapshot from the ROOTDISK
@@ -915,7 +938,7 @@ class TestResourceLimitsProject(cloudstackTestCase):
         self.debug("Creating template from volume: %s" % volume.id)
         # Create a template from the ROOTDISK
         template_1 = Template.create(
-                            self.apiclient,
+                            self.userapiclient,
                             self.services["template"],
                             volumeid=volume.id,
                             projectid=self.project.id
@@ -932,7 +955,7 @@ class TestResourceLimitsProject(cloudstackTestCase):
         # Exception should be raised for second template
         with self.assertRaises(Exception):
             Template.create(
-                            self.apiclient,
+                            self.userapiclient,
                             self.services["template"],
                             volumeid=volume.id,
                             projectid=self.project.id