def test_01_test_settings_for_domain(self): """ 1. Get the default value for the setting in domain scope 2. Change the default value to new value 3. Make sure updated value is same as new value 4. Reset the config value 5. Make sure that current value is same as default value :return: """ config_name="ldap.basedn" #1. Get default value configs = Configurations.list( self.apiclient, name=config_name ) self.assertIsNotNone(configs, "Fail to get domain setting %s " % config_name) orig_value = str(configs[0].value) new_value = "testing" #2. Update to new value Configurations.update( self.apiclient, name=config_name, value=new_value, domainid=self.domain.id ) configs = Configurations.list( self.apiclient, name=config_name, domainid=self.domain.id ) self.assertIsNotNone(configs, "Fail to get domain setting %s " % config_name) #3. validate they are same self.assertEqual(new_value, str(configs[0].value), "Failed to set new config value") #4. Reset the value Configurations.reset( self.apiclient, name=config_name, domainid=self.domain.id ) #5. Make sure its same as original value configs = Configurations.list( self.apiclient, name=config_name, domainid=self.domain.id ) self.assertIsNotNone(configs, "Fail to get domain setting %s " % config_name) self.assertEqual(orig_value, str(configs[0].value), "Failed to reset the value")
def test_05_test_settings_for_zone(self): """ 1. Get the default value for the setting in zone scope 2. Change the default value to new value 3. Make sure updated value is same as new value 4. Reset the config value 5. Make sure that current value is same as default value :return: """ config_name = "enable.dynamic.scale.vm" configs = Configurations.list( self.apiclient, name=config_name, zoneid=self.zone.id ) self.assertIsNotNone(configs, "Fail to get zone setting %s " % config_name) orig_value = str(configs[0].value) new_value = 'true' Configurations.update( self.apiclient, name=config_name, value=new_value, zoneid=self.zone.id ) configs = Configurations.list( self.apiclient, name=config_name, zoneid=self.zone.id ) self.assertIsNotNone(configs, "Fail to get ol setting %s " % config_name) self.assertEqual(new_value, (configs[0].value), "Failed to set new config value") Configurations.reset( self.apiclient, name=config_name, zoneid=self.zone.id ) configs = Configurations.list( self.apiclient, name=config_name, zoneid=self.zone.id ) self.assertIsNotNone(configs, "Fail to get zone setting %s " % config_name) self.assertEqual(orig_value, (configs[0].value), "Failed to reset the value for zone")
def test_03_test_settings_for_cluster(self): """ 1. Get the default value for the setting in cluster scope 2. Change the default value to new value 3. Make sure updated value is same as new value 4. Reset the config value 5. Make sure that current value is same as default value :return: """ cluster = Cluster.list( self.apiclient ) self.assertIsNotNone(cluster[0], "There should be atleast 1 cluster in the zone") config_name = "cluster.storage.operations.exclude" configs = Configurations.list( self.apiclient, name=config_name, clusterid=cluster[0].id ) self.assertIsNotNone(configs, "Fail to get cluster setting %s " % config_name) orig_value = str(configs[0].value) new_value = "true" Configurations.update( self.apiclient, name=config_name, value=new_value, clusterid=cluster[0].id ) configs = Configurations.list( self.apiclient, name=config_name, clusterid=cluster[0].id ) self.assertIsNotNone(configs, "Fail to get cluster setting %s " % config_name) self.assertEqual(new_value, str(configs[0].value), "Failed to set new config value") Configurations.reset( self.apiclient, name=config_name, clusterid=cluster[0].id ) configs = Configurations.list( self.apiclient, name=config_name, clusterid=cluster[0].id ) self.assertIsNotNone(configs, "Fail to get cluster setting %s " % config_name) self.assertEqual(orig_value, str(configs[0].value), "Failed to reset the value")
def test_04_test_settings_for_storage(self): """ 1. Get the default value for the setting in storage scope 2. Change the default value to new value 3. Make sure updated value is same as new value 4. Reset the config value 5. Make sure that current value is same as default value :return: """ storage = StoragePool.list( self.apiclient ) self.assertIsNotNone(storage[0], "There should be atleast 1 primary storage pool in the zone") config_name = "vmware.create.full.clone" configs = Configurations.list( self.apiclient, name=config_name, storageid=storage[0].id ) self.assertIsNotNone(configs, "Fail to get storage pool setting %s " % config_name) orig_value = str(configs[0].value) new_value = 'false' Configurations.update( self.apiclient, name=config_name, value=new_value, storageid=storage[0].id ) configs = Configurations.list( self.apiclient, name=config_name, storageid=storage[0].id ) self.assertIsNotNone(configs, "Fail to get storage pool setting %s " % config_name) self.assertEqual(new_value, (configs[0].value), "Failed to set new config value") Configurations.reset( self.apiclient, name=config_name, storageid=storage[0].id ) configs = Configurations.list( self.apiclient, name=config_name, storage=storage[0].id ) self.assertIsNotNone(configs, "Fail to get storage pool setting %s " % config_name) self.assertEqual(orig_value, (configs[0].value), "Failed to reset the value for storage pool")
def test_02_test_settings_for_account(self): """ 1. Get the default value for the setting in account scope 2. Change the default value to new value 3. Make sure updated value is same as new value 4. Reset the config value 5. Make sure that current value is same as default value :return: """ accounts = Account.list( self.apiclient, domainid=self.domain.id, listall=True ) self.assertIsNotNone(accounts[0], "There should be atleast 1 account in the zone") config_name = "enable.additional.vm.configuration" #1. Get the default value configs = Configurations.list( self.apiclient, name=config_name ) self.assertIsNotNone(configs, "Fail to get account setting %s " % config_name) orig_value = str(configs[0].value) new_value = "true" Configurations.update( self.apiclient, name=config_name, value=new_value, accountid=accounts[0].id ) configs = Configurations.list( self.apiclient, name=config_name, accountid=accounts[0].id ) self.assertIsNotNone(configs, "Fail to get account setting %s " % config_name) self.assertEqual(new_value, str(configs[0].value), "Failed to set new config value") Configurations.reset( self.apiclient, name=config_name, accountid=accounts[0].id ) configs = Configurations.list( self.apiclient, name=config_name, accountid=accounts[0].id ) self.assertIsNotNone(configs, "Fail to get account setting %s " % config_name) self.assertEqual(orig_value, str(configs[0].value), "Failed to reset the value")