From 762977d7c6f35c6f412dddc87a832a0bafc4db87 Mon Sep 17 00:00:00 2001 From: Prasanna Santhanam Date: Wed, 24 Apr 2013 14:37:39 +0530 Subject: [PATCH] Account object dereferences as account.name Previously the jsonHelper would incorrectly deserialize the json response if the object returned had an attribute of the same name resulting in an additional level of indirection to refer to the entity's attributes. eg: account.account.name instead of account.name This fixes the tests that have still the same indirection exposed. Signed-off-by: Prasanna Santhanam --- .../integration/smoke/test_affinity_groups.py | 10 +++---- .../integration/smoke/test_public_ip_range.py | 6 ++-- test/integration/smoke/test_vm_life_cycle.py | 28 +++++++++---------- 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/test/integration/smoke/test_affinity_groups.py b/test/integration/smoke/test_affinity_groups.py index 832c4a4e1fa..3ed31152643 100644 --- a/test/integration/smoke/test_affinity_groups.py +++ b/test/integration/smoke/test_affinity_groups.py @@ -91,7 +91,7 @@ class TestDeployVmWithAffinityGroup(cloudstackTestCase): domainid=cls.domain.id ) - cls.services["account"] = cls.account.account.name + cls.services["account"] = cls.account.name cls.service_offering = ServiceOffering.create( cls.api_client, @@ -120,8 +120,8 @@ class TestDeployVmWithAffinityGroup(cloudstackTestCase): self.api_client, self.services["virtual_machine"], templateid=self.template.id, - accountid=self.account.account.name, - domainid=self.account.account.domainid, + accountid=self.account.name, + domainid=self.account.domainid, serviceofferingid=self.service_offering.id, affinitygroupnames=[self.ag.name] ) @@ -153,8 +153,8 @@ class TestDeployVmWithAffinityGroup(cloudstackTestCase): self.api_client, self.services["virtual_machine"], templateid=self.template.id, - accountid=self.account.account.name, - domainid=self.account.account.domainid, + accountid=self.account.name, + domainid=self.account.domainid, serviceofferingid=self.service_offering.id, affinitygroupnames=[self.ag.name] ) diff --git a/test/integration/smoke/test_public_ip_range.py b/test/integration/smoke/test_public_ip_range.py index 7c965ea1d94..f2099ff432a 100644 --- a/test/integration/smoke/test_public_ip_range.py +++ b/test/integration/smoke/test_public_ip_range.py @@ -139,8 +139,8 @@ class TesDedicatePublicIPRange(cloudstackTestCase): dedicate_public_ip_range_response = PublicIpRange.dedicate( self.apiclient, self.public_ip_range.vlan.id, - account=self.account.account.name, - domainid=self.account.account.domainid + account=self.account.name, + domainid=self.account.domainid ) list_public_ip_range_response = PublicIpRange.list( self.apiclient, @@ -149,7 +149,7 @@ class TesDedicatePublicIPRange(cloudstackTestCase): public_ip_response = list_public_ip_range_response[0] self.assertEqual( public_ip_response.account, - self.account.account.name, + self.account.name, "Check account name is in listVlanIpRanges as the account public ip range is dedicated to" ) diff --git a/test/integration/smoke/test_vm_life_cycle.py b/test/integration/smoke/test_vm_life_cycle.py index cf9fd7530f1..ae36c648e0a 100644 --- a/test/integration/smoke/test_vm_life_cycle.py +++ b/test/integration/smoke/test_vm_life_cycle.py @@ -172,8 +172,8 @@ class TestDeployVM(cloudstackTestCase): cls.virtual_machine = VirtualMachine.create( cls.apiclient, cls.services["small"], - accountid=cls.account.account.name, - domainid=cls.account.account.domainid, + accountid=cls.account.name, + domainid=cls.account.domainid, serviceofferingid=cls.service_offering.id, mode=cls.services['mode'] ) @@ -250,12 +250,12 @@ class TestDeployVM(cloudstackTestCase): 3. Has a linklocalip, publicip and a guestip @return: """ - routers = list_routers(self.apiclient, account=self.account.account.name) + routers = list_routers(self.apiclient, account=self.account.name) self.assertTrue(len(routers) > 0, msg = "No virtual router found") router = routers[0] self.assertEqual(router.state, 'Running', msg="Router is not in running state") - self.assertEqual(router.account, self.account.account.name, msg="Router does not belong to the account") + self.assertEqual(router.account, self.account.name, msg="Router does not belong to the account") #Has linklocal, public and guest ips self.assertIsNotNone(router.linklocalip, msg="Router has no linklocal ip") @@ -271,12 +271,12 @@ class TestDeployVM(cloudstackTestCase): 2. is in the account the VM was deployed in @return: """ - routers = list_routers(self.apiclient, account=self.account.account.name) + routers = list_routers(self.apiclient, account=self.account.name) self.assertTrue(len(routers) > 0, msg = "No virtual router found") router = routers[0] self.assertEqual(router.state, 'Running', msg="Router is not in running state") - self.assertEqual(router.account, self.account.account.name, msg="Router does not belong to the account") + self.assertEqual(router.account, self.account.name, msg="Router does not belong to the account") def tearDown(self): pass @@ -334,24 +334,24 @@ class TestVMLifeCycle(cloudstackTestCase): cls.small_virtual_machine = VirtualMachine.create( cls.api_client, cls.services["small"], - accountid=cls.account.account.name, - domainid=cls.account.account.domainid, + accountid=cls.account.name, + domainid=cls.account.domainid, serviceofferingid=cls.small_offering.id, mode=cls.services["mode"] ) cls.medium_virtual_machine = VirtualMachine.create( cls.api_client, cls.services["medium"], - accountid=cls.account.account.name, - domainid=cls.account.account.domainid, + accountid=cls.account.name, + domainid=cls.account.domainid, serviceofferingid=cls.medium_offering.id, mode=cls.services["mode"] ) cls.virtual_machine = VirtualMachine.create( cls.api_client, cls.services["small"], - accountid=cls.account.account.name, - domainid=cls.account.account.domainid, + accountid=cls.account.name, + domainid=cls.account.domainid, serviceofferingid=cls.small_offering.id, mode=cls.services["mode"] ) @@ -939,8 +939,8 @@ class TestVMLifeCycle(cloudstackTestCase): iso = Iso.create( self.apiclient, self.services["iso"], - account=self.account.account.name, - domainid=self.account.account.domainid + account=self.account.name, + domainid=self.account.domainid ) self.debug("Successfully created ISO with ID: %s" % iso.id)