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 <tsp@apache.org>
This commit is contained in:
Prasanna Santhanam 2013-04-24 14:37:39 +05:30
parent 403f7b5b87
commit 762977d7c6
3 changed files with 22 additions and 22 deletions

View File

@ -91,7 +91,7 @@ class TestDeployVmWithAffinityGroup(cloudstackTestCase):
domainid=cls.domain.id domainid=cls.domain.id
) )
cls.services["account"] = cls.account.account.name cls.services["account"] = cls.account.name
cls.service_offering = ServiceOffering.create( cls.service_offering = ServiceOffering.create(
cls.api_client, cls.api_client,
@ -120,8 +120,8 @@ class TestDeployVmWithAffinityGroup(cloudstackTestCase):
self.api_client, self.api_client,
self.services["virtual_machine"], self.services["virtual_machine"],
templateid=self.template.id, templateid=self.template.id,
accountid=self.account.account.name, accountid=self.account.name,
domainid=self.account.account.domainid, domainid=self.account.domainid,
serviceofferingid=self.service_offering.id, serviceofferingid=self.service_offering.id,
affinitygroupnames=[self.ag.name] affinitygroupnames=[self.ag.name]
) )
@ -153,8 +153,8 @@ class TestDeployVmWithAffinityGroup(cloudstackTestCase):
self.api_client, self.api_client,
self.services["virtual_machine"], self.services["virtual_machine"],
templateid=self.template.id, templateid=self.template.id,
accountid=self.account.account.name, accountid=self.account.name,
domainid=self.account.account.domainid, domainid=self.account.domainid,
serviceofferingid=self.service_offering.id, serviceofferingid=self.service_offering.id,
affinitygroupnames=[self.ag.name] affinitygroupnames=[self.ag.name]
) )

View File

@ -139,8 +139,8 @@ class TesDedicatePublicIPRange(cloudstackTestCase):
dedicate_public_ip_range_response = PublicIpRange.dedicate( dedicate_public_ip_range_response = PublicIpRange.dedicate(
self.apiclient, self.apiclient,
self.public_ip_range.vlan.id, self.public_ip_range.vlan.id,
account=self.account.account.name, account=self.account.name,
domainid=self.account.account.domainid domainid=self.account.domainid
) )
list_public_ip_range_response = PublicIpRange.list( list_public_ip_range_response = PublicIpRange.list(
self.apiclient, self.apiclient,
@ -149,7 +149,7 @@ class TesDedicatePublicIPRange(cloudstackTestCase):
public_ip_response = list_public_ip_range_response[0] public_ip_response = list_public_ip_range_response[0]
self.assertEqual( self.assertEqual(
public_ip_response.account, 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" "Check account name is in listVlanIpRanges as the account public ip range is dedicated to"
) )

View File

@ -172,8 +172,8 @@ class TestDeployVM(cloudstackTestCase):
cls.virtual_machine = VirtualMachine.create( cls.virtual_machine = VirtualMachine.create(
cls.apiclient, cls.apiclient,
cls.services["small"], cls.services["small"],
accountid=cls.account.account.name, accountid=cls.account.name,
domainid=cls.account.account.domainid, domainid=cls.account.domainid,
serviceofferingid=cls.service_offering.id, serviceofferingid=cls.service_offering.id,
mode=cls.services['mode'] mode=cls.services['mode']
) )
@ -250,12 +250,12 @@ class TestDeployVM(cloudstackTestCase):
3. Has a linklocalip, publicip and a guestip 3. Has a linklocalip, publicip and a guestip
@return: @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") self.assertTrue(len(routers) > 0, msg = "No virtual router found")
router = routers[0] router = routers[0]
self.assertEqual(router.state, 'Running', msg="Router is not in running state") 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 #Has linklocal, public and guest ips
self.assertIsNotNone(router.linklocalip, msg="Router has no linklocal ip") 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 2. is in the account the VM was deployed in
@return: @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") self.assertTrue(len(routers) > 0, msg = "No virtual router found")
router = routers[0] router = routers[0]
self.assertEqual(router.state, 'Running', msg="Router is not in running state") 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): def tearDown(self):
pass pass
@ -334,24 +334,24 @@ class TestVMLifeCycle(cloudstackTestCase):
cls.small_virtual_machine = VirtualMachine.create( cls.small_virtual_machine = VirtualMachine.create(
cls.api_client, cls.api_client,
cls.services["small"], cls.services["small"],
accountid=cls.account.account.name, accountid=cls.account.name,
domainid=cls.account.account.domainid, domainid=cls.account.domainid,
serviceofferingid=cls.small_offering.id, serviceofferingid=cls.small_offering.id,
mode=cls.services["mode"] mode=cls.services["mode"]
) )
cls.medium_virtual_machine = VirtualMachine.create( cls.medium_virtual_machine = VirtualMachine.create(
cls.api_client, cls.api_client,
cls.services["medium"], cls.services["medium"],
accountid=cls.account.account.name, accountid=cls.account.name,
domainid=cls.account.account.domainid, domainid=cls.account.domainid,
serviceofferingid=cls.medium_offering.id, serviceofferingid=cls.medium_offering.id,
mode=cls.services["mode"] mode=cls.services["mode"]
) )
cls.virtual_machine = VirtualMachine.create( cls.virtual_machine = VirtualMachine.create(
cls.api_client, cls.api_client,
cls.services["small"], cls.services["small"],
accountid=cls.account.account.name, accountid=cls.account.name,
domainid=cls.account.account.domainid, domainid=cls.account.domainid,
serviceofferingid=cls.small_offering.id, serviceofferingid=cls.small_offering.id,
mode=cls.services["mode"] mode=cls.services["mode"]
) )
@ -939,8 +939,8 @@ class TestVMLifeCycle(cloudstackTestCase):
iso = Iso.create( iso = Iso.create(
self.apiclient, self.apiclient,
self.services["iso"], self.services["iso"],
account=self.account.account.name, account=self.account.name,
domainid=self.account.account.domainid domainid=self.account.domainid
) )
self.debug("Successfully created ISO with ID: %s" % iso.id) self.debug("Successfully created ISO with ID: %s" % iso.id)