cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t..@apache.org
Subject [31/50] [abbrv] git commit: updated refs/heads/marvin-refactor to bbaf354
Date Wed, 02 Oct 2013 16:42:01 GMT
marvin_refactor: include an example with should-dsl

Signed-off-by: Prasanna Santhanam <tsp@apache.org>


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

Branch: refs/heads/marvin-refactor
Commit: c640a328d55f5a19d737585a74df5c11cfc8477f
Parents: 1b82d7c
Author: Prasanna Santhanam <tsp@apache.org>
Authored: Fri Sep 13 15:58:33 2013 +0530
Committer: Prasanna Santhanam <tsp@apache.org>
Committed: Wed Oct 2 20:27:51 2013 +0530

----------------------------------------------------------------------
 tools/marvin/marvin/test/test_factories.py | 110 +++++++++++++-----------
 1 file changed, 62 insertions(+), 48 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c640a328/tools/marvin/marvin/test/test_factories.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/test/test_factories.py b/tools/marvin/marvin/test/test_factories.py
index 81e78a7..c2c823c 100644
--- a/tools/marvin/marvin/test/test_factories.py
+++ b/tools/marvin/marvin/test/test_factories.py
@@ -18,6 +18,7 @@
 import unittest
 import logging
 from nose.plugins.attrib import attr
+from should_dsl import should, should_not
 
 from marvin.cloudstackTestClient import cloudstackTestClient
 
@@ -31,16 +32,15 @@ from marvin.factory.data.network import *
 from marvin.factory.virtualmachine import *
 
 from marvin.entity.serviceoffering import ServiceOffering
+from marvin.entity.networkoffering import NetworkOffering
 from marvin.entity.zone import Zone
 from marvin.entity.account import Account
 from marvin.entity.template import Template
 from marvin.entity.user import User
 from marvin.entity.network import Network
-
 from marvin.entity.ipaddress import IpAddress
 
 
-
 class BuildVsCreateStrategyTest(unittest.TestCase):
     def setUp(self):
         self.apiClient = cloudstackTestClient(mgtSvr='localhost', logging=logging.getLogger('factory.cloudstack')).getApiClient()
@@ -115,6 +115,65 @@ class NetworkOfferingFactoryTest(unittest.TestCase):
         pass
 
 
+class UserFactorySubFactoryTest(unittest.TestCase):
+    def setUp(self):
+        self.apiClient = cloudstackTestClient(mgtSvr='localhost', logging=logging.getLogger('factory.cloudstack')).getApiClient()
+
+    def tearDown(self):
+        pass
+
+    @unittest.skip("This is a chicken and egg problem")
+    def test_userSubFactory(self):
+        """
+        Skip because users are contained in accounts but
+        cannot be created until accounts exist
+
+        A subfactory is unsuitable as the semantics of the
+        caller is not to create the user before creating the account
+        @return:
+        """
+        uf = UserFactory(apiclient=self.apiClient)
+        user = User.list(apiclient=self.apiClient, username=uf.username)
+        self.assert_(uf.username == user[0].username, msg="Usernames don't match")
+
+
+class NetworkFactoryTest(unittest.TestCase):
+    def setUp(self):
+        self.apiClient = cloudstackTestClient(mgtSvr='localhost',
+            logging=logging.getLogger('factory.cloudstack')).getApiClient()
+
+    def tearDown(self):
+        self.accnt.delete(apiclient=self.apiClient)
+
+    @attr(tags='network')
+    def test_isolatedGuestNetwork(self):
+        """Test to create a network within a guest account
+        @return:
+        """
+        self.accnt = UserAccountFactory(apiclient=self.apiClient)
+        zones = Zone.list(apiclient=self.apiClient)
+        network = GuestIsolatedNetworkFactory(
+            apiclient=self.apiClient,
+            zoneid=zones[0].id
+            )
+        logging.getLogger('factory.cloudstack').debug("network created with id %s, name %s"
%(network.id, network.name))
+
+
+class NetworkOfferingFactoryWithMultiplePostHooksTest(unittest.TestCase):
+    def setUp(self):
+        self.apiClient = cloudstackTestClient(mgtSvr='localhost',
+            logging=logging.getLogger('factory.cloudstack')).getApiClient()
+
+    @attr(tags='post')
+    def test_multiplePostHooksNetworkOffering(self):
+        sharedOffering = DefaultSharedNetworkOfferingFactory(apiclient=self.apiClient)
+        sharedOffering |should| be_instance_of(NetworkOffering)
+        sharedOffering |should_not| equal_to(None)
+        sharedOffering.state |should| equal_to('Enabled')
+        logging.getLogger('factory.cloudstack').debug("networkoffering created with id %s,
name %s, state %s"
+                                                      %(sharedOffering.id, sharedOffering.name,
sharedOffering.state))
+
+
 class VirtualMachineFactoryTest(unittest.TestCase):
     def setUp(self):
         self.apiClient = cloudstackTestClient(mgtSvr='localhost', logging=logging.getLogger('factory.cloudstack')).getApiClient()
@@ -139,29 +198,6 @@ class VirtualMachineFactoryTest(unittest.TestCase):
                                           domainid = accnt.domainid)
 
 
-
-class UserFactorySubFactoryTest(unittest.TestCase):
-    def setUp(self):
-        self.apiClient = cloudstackTestClient(mgtSvr='localhost', logging=logging.getLogger('factory.cloudstack')).getApiClient()
-
-    def tearDown(self):
-        pass
-
-    @unittest.skip("This is a chicken and egg problem")
-    def test_userSubFactory(self):
-        """
-        Skip because users are contained in accounts but
-        cannot be created until accounts exist
-
-        A subfactory is unsuitable as the semantics of the
-        caller is not to create the user before creating the account
-        @return:
-        """
-        uf = UserFactory(apiclient=self.apiClient)
-        user = User.list(apiclient=self.apiClient, username=uf.username)
-        self.assert_(uf.username == user[0].username, msg="Usernames don't match")
-
-
 class IpAddressFactoryTest(unittest.TestCase):
     def setUp(self):
         self.apiClient = cloudstackTestClient(mgtSvr='localhost',
@@ -192,26 +228,4 @@ class IpAddressFactoryTest(unittest.TestCase):
         firstip = all_ips[0]
         networks = Network.list(apiclient=self.apiClient,
             account = accnt.name, domainid = accnt.domainid)
-        firstip.associate(apiclient=self.apiClient, networkid = networks[0].id)
-
-
-class NetworkFactoryTest(unittest.TestCase):
-    def setUp(self):
-        self.apiClient = cloudstackTestClient(mgtSvr='localhost',
-            logging=logging.getLogger('factory.cloudstack')).getApiClient()
-
-    def tearDown(self):
-        self.accnt.delete(apiclient=self.apiClient)
-
-    @attr(tags='network')
-    def test_isolatedGuestNetwork(self):
-        """Test to create a network within a guest account
-        @return:
-        """
-        self.accnt = UserAccountFactory(apiclient=self.apiClient)
-        zones = Zone.list(apiclient=self.apiClient)
-        network = GuestIsolatedNetworkFactory(
-            apiclient=self.apiClient,
-            zoneid=zones[0].id
-            )
-        logging.getLogger('factory.cloudstack').debug("network created with id %s, name %s"
%(network.id, network.name))
\ No newline at end of file
+        firstip.associate(apiclient=self.apiClient, networkid = networks[0].id)
\ No newline at end of file


Mime
View raw message