diff --git a/test/integration/smoke/test_domain_disk_offerings.py b/test/integration/smoke/test_domain_disk_offerings.py index 92cc3a8ffa2..953d68034b8 100644 --- a/test/integration/smoke/test_domain_disk_offerings.py +++ b/test/integration/smoke/test_domain_disk_offerings.py @@ -228,8 +228,8 @@ class TestDomainsDiskOfferings(cloudstackTestCase): """Test to update existing disk offering""" # 1. updateDiskOffering should return a valid information for the updated offering - # 2. updateDiskOffering should fail while tring to add child domain but parent domain - # is already present + # 2. updateDiskOffering should fail when trying to add child domain but parent domain is + # also passed # 3. updateDiskOffering should be able to add new domain to the offering self.debug("Updating disk offering with ID: %s" % self.disk_offering.id) @@ -237,17 +237,9 @@ class TestDomainsDiskOfferings(cloudstackTestCase): cmd = updateDiskOffering.updateDiskOfferingCmd() # Add parameters for API call cmd.id = self.disk_offering.id - cmd.domainid = self.domain_11.id - try: - self.apiclient.updateDiskOffering(cmd) - self.fail("Child domain added to offering when parent domain already exist. Must be an error.") - except CloudstackAPIException: - self.debug("Child domain check") - - - cmd = updateDiskOffering.updateDiskOfferingCmd() - cmd.id = self.disk_offering.id - cmd.domainid = self.domain_2.id + input_domainid ="{0},{1},{2}".format(self.domain_1.id, self.domain_11.id, self.domain_2.id) + result_domainid = "{0},{1}".format(self.domain_1.id, self.domain_2.id) + cmd.domainid = input_domainid self.apiclient.updateDiskOffering(cmd) list_disk_response = list_disk_offering( @@ -266,11 +258,20 @@ class TestDomainsDiskOfferings(cloudstackTestCase): "Check Disk offering is updated" ) - domainid = "{0},{1}".format(self.domain_1.id, self.domain_2.id) + try: + self.assertItemsEqual( + list_disk_response[0].domainid.split(","), + input_domainid.split(","), + "Check child domainid in updateDiskOffering, should fail" + ) + self.fail("Child domain added to offering when parent domain already exist. Must be an error.") + except AssertionError: + self.debug("Child domain check successful") + self.assertItemsEqual( list_disk_response[0].domainid.split(","), - domainid.split(","), - "Check domainid in createDiskOffering" + result_domainid.split(","), + "Check domainid in updateDiskOffering" ) return diff --git a/test/integration/smoke/test_domain_network_offerings.py b/test/integration/smoke/test_domain_network_offerings.py index e4a34822065..a1014e2ae23 100644 --- a/test/integration/smoke/test_domain_network_offerings.py +++ b/test/integration/smoke/test_domain_network_offerings.py @@ -224,8 +224,8 @@ class TestDomainsNetworkOfferings(cloudstackTestCase): """Test to update existing network offering""" # 1. updateNetworkOffering should return a valid information for the updated offering - # 2. updateNetworkOffering should fail while tring to add child domain but parent domain - # is already present + # 2. updateNetworkOffering should fail while trying to add child domain but parent domain + # is also passed # 3. updateNetworkOffering should be able to add new domain to the offering self.debug("Updating network offering with ID: %s" % self.network_offering.id) @@ -233,17 +233,9 @@ class TestDomainsNetworkOfferings(cloudstackTestCase): cmd = updateNetworkOffering.updateNetworkOfferingCmd() # Add parameters for API call cmd.id = self.network_offering.id - cmd.domainid = self.domain_11.id - try: - self.apiclient.updateNetworkOffering(cmd) - self.fail("Child domain added to offering when parent domain already exist. Must be an error.") - except CloudstackAPIException: - self.debug("Child domain check") - - - cmd = updateNetworkOffering.updateNetworkOfferingCmd() - cmd.id = self.network_offering.id - cmd.domainid = self.domain_2.id + input_domainid ="{0},{1},{2}".format(self.domain_1.id, self.domain_11.id, self.domain_2.id) + result_domainid = "{0},{1}".format(self.domain_1.id, self.domain_2.id) + cmd.domainid = input_domainid self.apiclient.updateNetworkOffering(cmd) cmd = listNetworkOfferings.listNetworkOfferingsCmd() @@ -261,10 +253,20 @@ class TestDomainsNetworkOfferings(cloudstackTestCase): "Check Network offering is updated" ) + try: + self.assertItemsEqual( + list_network_response[0].domainid.split(","), + input_domainid.split(","), + "Check child domainid in updateServiceOffering, should fail" + ) + self.fail("Child domain added to offering when parent domain already exist. Must be an error.") + except AssertionError: + self.debug("Child domain check successful") + domainid = "{0},{1}".format(self.domain_1.id, self.domain_2.id) self.assertItemsEqual( list_network_response[0].domainid.split(","), - domainid.split(","), + result_domainid.split(","), "Check domainid in createNetworkOffering" ) return diff --git a/test/integration/smoke/test_domain_service_offerings.py b/test/integration/smoke/test_domain_service_offerings.py index f2fd470d5a0..0f71f8c4f64 100644 --- a/test/integration/smoke/test_domain_service_offerings.py +++ b/test/integration/smoke/test_domain_service_offerings.py @@ -273,8 +273,8 @@ class TestDomainsServiceOfferings(cloudstackTestCase): # Validate the following: # 1. updateServiceOffering should return a valid information for the updated offering - # 2. updateServiceOffering should fail when try t add child domain but parent domain is - # already present + # 2. updateServiceOffering should fail when trying to add child domain but parent domain is + # also passed # 3. updateServiceOffering should be able to add new domain to the offering self.debug("Updating service offering with ID: %s" % self.service_offering.id) @@ -282,17 +282,9 @@ class TestDomainsServiceOfferings(cloudstackTestCase): cmd = updateServiceOffering.updateServiceOfferingCmd() # Add parameters for API call cmd.id = self.service_offering.id - cmd.domainid = self.domain_11.id - try: - self.apiclient.updateServiceOffering(cmd) - self.fail("Child domain added to offering when parent domain already exist. Must be an error.") - except CloudstackAPIException: - self.debug("Child domain check") - - - cmd = updateServiceOffering.updateServiceOfferingCmd() - cmd.id = self.service_offering.id - cmd.domainid = self.domain_2.id + input_domainid ="{0},{1},{2}".format(self.domain_1.id, self.domain_11.id, self.domain_2.id) + result_domainid = "{0},{1}".format(self.domain_1.id, self.domain_2.id) + cmd.domainid = input_domainid self.apiclient.updateServiceOffering(cmd) list_service_response = list_service_offering( @@ -311,11 +303,20 @@ class TestDomainsServiceOfferings(cloudstackTestCase): "Check Service offering is updated" ) - domainid = "{0},{1}".format(self.domain_1.id, self.domain_2.id) + try: + self.assertItemsEqual( + list_service_response[0].domainid.split(","), + input_domainid.split(","), + "Check child domainid in updateServiceOffering, should fail" + ) + self.fail("Child domain added to offering when parent domain already exist. Must be an error.") + except AssertionError: + self.debug("Child domain check successful") + self.assertItemsEqual( list_service_response[0].domainid.split(","), - domainid.split(","), - "Check domainid in createServiceOffering" + result_domainid.split(","), + "Check domainid in updateServiceOffering" ) return diff --git a/test/integration/smoke/test_domain_vpc_offerings.py b/test/integration/smoke/test_domain_vpc_offerings.py index e3199876846..d24e05bd7d7 100644 --- a/test/integration/smoke/test_domain_vpc_offerings.py +++ b/test/integration/smoke/test_domain_vpc_offerings.py @@ -278,10 +278,11 @@ class TestDomainsVpcOfferings(cloudstackTestCase): self.debug("Updating vpc offering with ID: %s" % self.vpc_offering.id) - offering_data_domainid = "{0},{1}".format(self.domain_1.id, self.domain_2.id) cmd = updateVPCOffering.updateVPCOfferingCmd() cmd.id = self.vpc_offering.id - cmd.domainid = offering_data_domainid + input_domainid ="{0},{1},{2}".format(self.domain_1.id, self.domain_11.id, self.domain_2.id) + result_domainid = "{0},{1}".format(self.domain_1.id, self.domain_2.id) + cmd.domainid = input_domainid self.apiclient.updateVPCOffering(cmd) cmd = listVPCOfferings.listVPCOfferingsCmd() @@ -298,22 +299,23 @@ class TestDomainsVpcOfferings(cloudstackTestCase): 0, "Check Vpc offering is updated" ) + + try: + self.assertItemsEqual( + list_vpc_response[0].domainid.split(","), + input_domainid.split(","), + "Check child domainid in updateServiceOffering, should fail" + ) + self.fail("Child domain added to offering when parent domain already exist. Must be an error.") + except AssertionError: + self.debug("Child domain check successful") + self.assertItemsEqual( list_vpc_response[0].domainid.split(","), - offering_data_domainid.split(","), + result_domainid.split(","), "Check domainid in createVPCOffering" ) - cmd = updateVPCOffering.updateVPCOfferingCmd() - # Add parameters for API call - cmd.id = self.vpc_offering.id - cmd.domainid = self.domain_11.id - try: - self.apiclient.updateVPCOffering(cmd) - self.fail("Child domain added to offering when parent domain already exist. Must be an error.") - except Exception as e: - self.debug("Child domain check %s" % e) - @attr( tags=[ "advanced",