cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t..@apache.org
Subject [03/17] git commit: updated refs/heads/marvin_refactor to dd838d7
Date Sun, 21 Apr 2013 12:23:16 GMT
SubFactory or RelatedFactory

Can't make up my mind!!???


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

Branch: refs/heads/marvin_refactor
Commit: a531a7f57fbaf941f006a9422cd6366568a8c6af
Parents: 46bc06e
Author: Prasanna Santhanam <tsp@apache.org>
Authored: Sun Apr 21 12:16:40 2013 +0530
Committer: Prasanna Santhanam <tsp@apache.org>
Committed: Sun Apr 21 12:16:40 2013 +0530

----------------------------------------------------------------------
 .../marvin/integration/lib/factory/UserFactory.py  |    4 +-
 .../integration/lib/factory/test/testFactories.py  |   32 ++++++++------
 2 files changed, 20 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a531a7f5/tools/marvin/marvin/integration/lib/factory/UserFactory.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/integration/lib/factory/UserFactory.py b/tools/marvin/marvin/integration/lib/factory/UserFactory.py
index 84218c1..1b13b8b 100644
--- a/tools/marvin/marvin/integration/lib/factory/UserFactory.py
+++ b/tools/marvin/marvin/integration/lib/factory/UserFactory.py
@@ -23,7 +23,7 @@ class UserFactory(CloudStackBaseFactory):
 
     FACTORY_FOR = User.User
 
-    account = factory.RelatedFactory(AccountFactory).factory()
+    account = factory.SubFactory(AccountFactory).factory()
     email = account.email
     firstname = account.firstname
     lastname = account.lastname
@@ -31,4 +31,4 @@ class UserFactory(CloudStackBaseFactory):
     username = account.username
 
 class AdminUserFactory(UserFactory):
-    account = factory.RelatedFactory(AccountFactory, accounttype=1).factory()
+    account = factory.SubFactory(AccountFactory, accounttype=1).factory()

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a531a7f5/tools/marvin/marvin/integration/lib/factory/test/testFactories.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/integration/lib/factory/test/testFactories.py b/tools/marvin/marvin/integration/lib/factory/test/testFactories.py
index 41217d2..fdef9c0 100644
--- a/tools/marvin/marvin/integration/lib/factory/test/testFactories.py
+++ b/tools/marvin/marvin/integration/lib/factory/test/testFactories.py
@@ -18,23 +18,20 @@
 import unittest
 import logging
 from marvin.cloudstackTestClient import cloudstackTestClient
-from marvin.integration.lib.common import get_template
 
 from marvin.integration.lib.factory.AccountFactory import *
 from marvin.integration.lib.base.Account import Account
 
 from marvin.integration.lib.factory.ServiceOfferingFactory import *
-from marvin.integration.lib.base.ServiceOffering import ServiceOffering
 
 from marvin.integration.lib.factory.NetworkOfferingFactory import *
-from marvin.integration.lib.base.NetworkOffering import NetworkOffering
 
 from marvin.integration.lib.base.Zone import Zone
 
 from marvin.integration.lib.factory.TemplateFactory import *
+from marvin.integration.lib.base.Template import Template
 
 from marvin.integration.lib.factory.VirtualMachineFactory import *
-from marvin.integration.lib.base.VirtualMachine import VirtualMachine
 
 from marvin.integration.lib.factory.UserFactory import *
 from marvin.integration.lib.base.User import User
@@ -73,12 +70,10 @@ class AccountFactoryTest(unittest.TestCase):
         self.assert_(accnt is not None, msg="no account created by factory")
         self.assert_(accnt.account.name is not None)
 
-    @unittest.skip("Job Queue gets stuck on this")
+    @unittest.skip("Account doesn't deserialize correctly")
     def test_disableAccountPostFactoryGeneration(self):
-        af = DomainAdminFactory()
-        domadmin = DomainAdminFactory.create(apiclient=self.apiClient, factory=af)
+        domadmin = DomainAdminFactory.create(apiclient=self.apiClient)
         self.assert_(domadmin is not None, msg="no account was created")
-        self.assert_(domadmin.account.name, af.username, msg = "account names don't match")
         domadmin.disable(self.apiClient, lock=True)
 
     def tearDown(self):
@@ -124,13 +119,22 @@ class VirtualMachineFactoryTest(unittest.TestCase):
         pass
 
     def test_virtualMachineDeploy(self):
-        sf = SmallServiceOfferingFactory()
-        tf = DefaultBuiltInTemplateFactory()
-        service = ServiceOffering.create(apiclient=self.apiClient, factory=sf)
+        accnt = AccountFactory.create(apiclient=self.apiClient)
+        service = SmallServiceOfferingFactory.create(apiclient=self.apiClient)
+        tf = DefaultBuiltInTemplateFactory.build() #FIXME: Using build() strategy is confusing
         zones = Zone.list(apiclient=self.apiClient)
-        template = get_template(apiclient=self.apiClient, zoneid = zones[0].id, ostype=tf.ostype)
-        vmf = VirtualMachineFactory(serviceofferingid = service.id, templateid = template.id,
zoneid = zones[0].id)
-        vm = VirtualMachine.deploy(apiclient=self.apiClient, factory=vmf)
+        template = Template.list(apiclient=self.apiClient,
+                                 templatefilter="featured",
+                                 ostype = tf.ostype,
+                                 zoneid = zones[0].id)
+        vm = VirtualMachineFactory.create(apiclient=self.apiClient,
+                                          serviceofferingid = service.id,
+                                          templateid = template[0].id,
+                                          zoneid = zones[0].id,
+                                          account = accnt.account.name,
+                                          domainid = accnt.account.domainid)
+        vm.destroy(apiclient=self.apiClient)
+
 
 
 class UserFactorySubFactoryTest(unittest.TestCase):


Mime
View raw message