marvin_refactor: hiding SubFactory attributes attributes generated from subfactory calls need to be hidden from the subsequent factory calls as these attributes are not part of the default factory
Signed-off-by: Prasanna Santhanam <t...@apache.org> Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/b9781884 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/b9781884 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/b9781884 Branch: refs/heads/marvin_refactor Commit: b97818844686ed96a8813cd50b4a6a2c9627f22f Parents: 26b4025 Author: Prasanna Santhanam <t...@apache.org> Authored: Wed Oct 2 19:45:13 2013 +0530 Committer: Prasanna Santhanam <t...@apache.org> Committed: Thu Oct 31 13:54:26 2013 +0530 ---------------------------------------------------------------------- tools/marvin/marvin/factory/data/diskoffering.py | 2 ++ tools/marvin/marvin/factory/data/firewallrule.py | 2 ++ tools/marvin/marvin/factory/data/network.py | 9 +++++++++ tools/marvin/marvin/factory/data/networkoffering.py | 8 ++++---- tools/marvin/marvin/factory/data/user.py | 6 ++++++ tools/marvin/marvin/factory/data/vm.py | 1 + tools/marvin/marvin/factory/data/vpc.py | 2 ++ tools/marvin/marvin/factory/data/zone.py | 1 + 8 files changed, 27 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b9781884/tools/marvin/marvin/factory/data/diskoffering.py ---------------------------------------------------------------------- diff --git a/tools/marvin/marvin/factory/data/diskoffering.py b/tools/marvin/marvin/factory/data/diskoffering.py index 89a48b4..bb3bab1 100644 --- a/tools/marvin/marvin/factory/data/diskoffering.py +++ b/tools/marvin/marvin/factory/data/diskoffering.py @@ -19,6 +19,7 @@ import factory from marvin.factory.diskoffering import DiskOfferingFactory from marvin.legacy.utils import random_gen + class SharedDiskOffering(DiskOfferingFactory): displaytext = "SharedDiskOffering" @@ -26,6 +27,7 @@ class SharedDiskOffering(DiskOfferingFactory): storagetype = "shared" disksize = 10 #MB + class LocalDiskOffering(DiskOfferingFactory): displaytext = "LocalDiskOffering" http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b9781884/tools/marvin/marvin/factory/data/firewallrule.py ---------------------------------------------------------------------- diff --git a/tools/marvin/marvin/factory/data/firewallrule.py b/tools/marvin/marvin/factory/data/firewallrule.py index 44cc17f..1eb0260 100644 --- a/tools/marvin/marvin/factory/data/firewallrule.py +++ b/tools/marvin/marvin/factory/data/firewallrule.py @@ -17,12 +17,14 @@ from marvin.factory.firewall import FirewallFactory + class SshFirewallRule(FirewallFactory): protocol = 'tcp' startport = 22 endport = 22 cidrlist = '0.0.0.0/0' + class HttpFirewallRule(FirewallFactory): protocol = 'tcp' startport = 80 http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b9781884/tools/marvin/marvin/factory/data/network.py ---------------------------------------------------------------------- diff --git a/tools/marvin/marvin/factory/data/network.py b/tools/marvin/marvin/factory/data/network.py index 50c0086..a6e5d47 100644 --- a/tools/marvin/marvin/factory/data/network.py +++ b/tools/marvin/marvin/factory/data/network.py @@ -22,8 +22,11 @@ from marvin.factory.data.networkoffering import DefaultIsolatedNetworkOfferingWi from marvin.factory.data.networkoffering import DefaultSharedNetworkOffering from marvin.factory.data.networkoffering import DefaultIsolatedNetworkOfferingForVpc + class GuestIsolatedNetwork(NetworkFactory): + FACTORY_HIDDEN_ARGS = ('networkoffering', ) + displaytext = factory.Sequence(lambda n: 'GuestIsolatedNetwork-%s' % random_gen()) name = factory.Sequence(lambda n: 'GuestIsolatedNetwork-%s' % random_gen()) networkoffering =\ @@ -35,8 +38,11 @@ class GuestIsolatedNetwork(NetworkFactory): networkofferingid = factory.LazyAttribute(lambda no: no.networkoffering.id if no.networkoffering else no.networkoffering) zoneid = None + class SharedNetwork(NetworkFactory): + FACTORY_HIDDEN_ARGS = ('networkoffering', ) + displaytext = factory.Sequence(lambda n: 'SharedNetwork-%s' % random_gen()) name = factory.Sequence(lambda n: 'SharedNetwork-%s' % random_gen()) networkoffering = \ @@ -48,8 +54,11 @@ class SharedNetwork(NetworkFactory): networkofferingid = factory.LazyAttribute(lambda no: no.networkoffering.id if no.networkoffering else no.networkoffering) zoneid = None + class DefaultVpcNetwork(NetworkFactory): + FACTORY_HIDDEN_ARGS = ('networkoffering', ) + displaytext = factory.Sequence(lambda n: 'DefaultVpcNetwork-%s' % random_gen()) name = factory.Sequence(lambda n: 'DefaultVpcNetwork-%s' % random_gen()) networkoffering = \ http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b9781884/tools/marvin/marvin/factory/data/networkoffering.py ---------------------------------------------------------------------- diff --git a/tools/marvin/marvin/factory/data/networkoffering.py b/tools/marvin/marvin/factory/data/networkoffering.py index 1a65f85..22dee2e 100644 --- a/tools/marvin/marvin/factory/data/networkoffering.py +++ b/tools/marvin/marvin/factory/data/networkoffering.py @@ -48,7 +48,7 @@ class DefaultIsolatedNetworkOfferingWithSourceNatService(NetworkOfferingFactory) def enable(self, create, extracted, **kwargs): if not create: return - self.update(apiclient=self.apiclient, id=self.id, state='Enabled') + self.update(id=self.id, state='Enabled') class DefaultSharedNetworkOfferingWithSGService(NetworkOfferingFactory): @@ -83,7 +83,7 @@ class DefaultSharedNetworkOfferingWithSGService(NetworkOfferingFactory): def enable(self, create, extracted, **kwargs): if not create: return - self.update(apiclient=self.apiclient, id=self.id, state='Enabled') + self.update(id=self.id, state='Enabled') class DefaultSharedNetworkOffering(NetworkOfferingFactory): @@ -114,7 +114,7 @@ class DefaultSharedNetworkOffering(NetworkOfferingFactory): def enable(self, create, extracted, **kwargs): if not create: return - self.update(apiclient=self.apiclient, id=self.id, state='Enabled') + self.update(id=self.id, state='Enabled') class DefaultIsolatedNetworkOfferingForVpc(NetworkOfferingFactory): @@ -145,4 +145,4 @@ class DefaultIsolatedNetworkOfferingForVpc(NetworkOfferingFactory): def enable(self, create, extracted, **kwargs): if not create: return - self.update(apiclient=self.apiclient, id=self.id, state='Enabled') + self.update(id=self.id, state='Enabled') http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b9781884/tools/marvin/marvin/factory/data/user.py ---------------------------------------------------------------------- diff --git a/tools/marvin/marvin/factory/data/user.py b/tools/marvin/marvin/factory/data/user.py index 588c294..acbe4d9 100644 --- a/tools/marvin/marvin/factory/data/user.py +++ b/tools/marvin/marvin/factory/data/user.py @@ -20,8 +20,11 @@ from marvin.factory.user import UserFactory from marvin.factory.data.account import UserAccount from marvin.legacy.utils import random_gen + class User(UserFactory): + FACTORY_HIDDEN_ARGS = ('account', ) + firstname = factory.Sequence(lambda n: random_gen()) lastname = factory.Sequence(lambda n: random_gen()) email = factory.LazyAttribute(lambda e: '{0}.{1}@cloudstack.org'.format(e.firstname, e.lastname).lower()) @@ -37,8 +40,11 @@ class User(UserFactory): username=factory.SelfAttribute('..username'), ) + class AdminUser(UserFactory): + FACTORY_HIDDEN_ARGS = ('account', ) + account = factory.SubFactory(UserAccount, apiclient=factory.SelfAttribute('..apiclient'), accounttype=1, http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b9781884/tools/marvin/marvin/factory/data/vm.py ---------------------------------------------------------------------- diff --git a/tools/marvin/marvin/factory/data/vm.py b/tools/marvin/marvin/factory/data/vm.py index 3f50b52..90f275c 100644 --- a/tools/marvin/marvin/factory/data/vm.py +++ b/tools/marvin/marvin/factory/data/vm.py @@ -63,6 +63,7 @@ class VpcVirtualMachine(VirtualMachineFactory): """ VirtualMachine within a VPC created by DefaultVPC offering """ + FACTORY_HIDDEN_ARGS = ('vpc', 'ntwk', ) vpc = factory.SubFactory( DefaultVpc, http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b9781884/tools/marvin/marvin/factory/data/vpc.py ---------------------------------------------------------------------- diff --git a/tools/marvin/marvin/factory/data/vpc.py b/tools/marvin/marvin/factory/data/vpc.py index fc0379c..0a90418 100644 --- a/tools/marvin/marvin/factory/data/vpc.py +++ b/tools/marvin/marvin/factory/data/vpc.py @@ -22,6 +22,8 @@ from marvin.legacy.utils import random_gen class DefaultVpc(VpcFactory): + FACTORY_HIDDEN_ARGS = ('vpcoffering', ) + name = factory.Sequence(lambda e: "DefaultVpc" + random_gen()) cidr = '10.0.0.1/24' displaytext = name http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b9781884/tools/marvin/marvin/factory/data/zone.py ---------------------------------------------------------------------- diff --git a/tools/marvin/marvin/factory/data/zone.py b/tools/marvin/marvin/factory/data/zone.py index 80cb67a..7cc2e32 100644 --- a/tools/marvin/marvin/factory/data/zone.py +++ b/tools/marvin/marvin/factory/data/zone.py @@ -19,6 +19,7 @@ import factory from marvin.factory.zone import ZoneFactory from marvin.legacy.utils import random_gen + class AdvancedZone(ZoneFactory): name = factory.Sequence(lambda n: "advzone" + random_gen()) networktype = "Advanced"