def test_negative_validate_matcher_value_with_default_type(self): """Error raised for matcher value not of default type. @id: 307b0ea1-a035-4ce1-bcc5-f582147359e7 @steps: 1. Override the parameter. 2. Update parameter default type with valid value. 3. Create a matcher with value that doesn't matches the default type. 4. Submit the change. @assert: Error raised for matcher value not of default type. """ sc_param_id = self.sc_params_ids_list.pop() SmartClassParameter.update({ 'id': sc_param_id, 'parameter-type': 'boolean', 'override': 1, 'default-value': u'true', }) with self.assertRaises(CLIReturnCodeError): SmartClassParameter.add_override_value({ 'smart-class-parameter-id': sc_param_id, 'match': 'domain=test.com', 'value': gen_string('alpha') })
def test_positive_create_matcher_puppet_default_value(self): """Create matcher for attribute in parameter, Where Value is puppet default value. @id: c08fcf25-e5c7-411e-beed-3741a24496fd @steps: 1. Override the parameter. 2. Set some default Value. 3. Create matcher with valid attribute type, name and puppet default value. 4. Submit the change. @assert: The matcher has been created successfully. """ sc_param_id = self.sc_params_ids_list.pop() SmartClassParameter.update({ 'id': sc_param_id, 'override': 1, 'default-value': gen_string('alpha'), }) SmartClassParameter.add_override_value({ 'smart-class-parameter-id': sc_param_id, 'match': 'domain=test.com', 'use-puppet-default': 1 }) sc_param = SmartClassParameter.info({ 'puppet-class': self.puppet_class['name'], 'id': sc_param_id, }) self.assertEqual( sc_param['override-values']['values']['1']['match'], 'domain=test.com' )
def test_negative_validate_default_value_with_list(self): """Error raised for default value not in list. @id: cdcafbea-612e-4b60-90de-fa0c76442bbe @steps: 1. Override the parameter. 2. Provide default value that doesn't matches the list of step 3. 3. Validate this value with list validator type and rule. 4. Submit the change. @assert: Error raised for default value not in list. """ value = gen_string('alphanumeric') sc_param_id = self.sc_params_ids_list.pop() with self.assertRaises(CLIReturnCodeError): SmartClassParameter.update({ 'id': sc_param_id, 'default-value': value, 'override': 1, 'validator-type': 'list', 'validator-rule': '5, test', }) sc_param = SmartClassParameter.info({ 'puppet-class': self.puppet_class['name'], 'id': sc_param_id, }) self.assertNotEqual(sc_param['default-value'], value)
def test_negative_validate_matcher_value_with_list(self): """Error raised for matcher value not in list. @id: 6e02c3f2-40aa-49ec-976d-7a12f5fa1e04 @steps: 1. Override the parameter. 2. Create a matcher with value that doesn't match the list of step 3. 3. Validate this value with list validator type and rule. 4. Submit the change. @assert: Error raised for matcher value not in list. """ sc_param_id = self.sc_params_ids_list.pop() SmartClassParameter.add_override_value({ 'smart-class-parameter-id': sc_param_id, 'match': 'domain=test.com', 'value': 'myexample' }) with self.assertRaises(CLIReturnCodeError): SmartClassParameter.update({ 'id': sc_param_id, 'default-value': '50', 'override': 1, 'validator-type': 'list', 'validator-rule': '25, example, 50', }) sc_param = SmartClassParameter.info({ 'puppet-class': self.puppet_class['name'], 'id': sc_param_id, }) self.assertNotEqual(sc_param['default-value'], '50')
def test_negative_validate_default_value_with_regex(self): """Error raised for default value not matching with regex. @id: f36ed6e8-04ef-4614-98b3-38703d8aeeb0 @steps: 1. Override the parameter. 2. Provide default value that doesn't matches the regex of step 3. 3. Validate this value with regex validator type and rule. 4. Submit the change. @assert: Error raised for default value not matching with regex. """ value = gen_string('alpha') sc_param_id = self.sc_params_ids_list.pop() with self.assertRaises(CLIReturnCodeError): SmartClassParameter.update({ 'id': sc_param_id, 'default-value': value, 'override': 1, 'validator-type': 'regexp', 'validator-rule': '[0-9]', }) sc_param = SmartClassParameter.info({ 'puppet-class': self.puppet_class['name'], 'id': sc_param_id, }) self.assertNotEqual(sc_param['default-value'], value)
def test_negative_validate_matcher_value_with_regex(self): """Error raised for matcher value not matching with regex. @id: b8b2f1c2-a20c-42d6-a687-79e6eee0268e @steps: 1. Override the parameter. 2. Create a matcher with value that doesn't match the regex of step 3. 3. Validate this value with regex validator type and rule. 4. Submit the change. @assert: Error raised for matcher value not matching with regex. """ value = gen_string('numeric') sc_param_id = self.sc_params_ids_list.pop() SmartClassParameter.add_override_value({ 'smart-class-parameter-id': sc_param_id, 'match': 'domain=test.com', 'value': gen_string('alpha') }) with self.assertRaises(CLIReturnCodeError): SmartClassParameter.update({ 'id': sc_param_id, 'default-value': value, 'override': 1, 'validator-type': 'regexp', 'validator-rule': '[0-9]', }) sc_param = SmartClassParameter.info({ 'puppet-class': self.puppet_class['name'], 'id': sc_param_id, }) self.assertNotEqual(sc_param['default-value'], value)
def test_positive_create_matcher_puppet_default_value(self): """Create matcher for attribute in parameter, Where Value is puppet default value. @id: c08fcf25-e5c7-411e-beed-3741a24496fd @steps: 1. Override the parameter. 2. Set some default Value. 3. Create matcher with valid attribute type, name and puppet default value. 4. Submit the change. @assert: The matcher has been created successfully. """ sc_param_id = self.sc_params_ids_list.pop() value = gen_string("alpha") SmartClassParameter.update({"id": sc_param_id, "override": 1, "default-value": gen_string("alpha")}) SmartClassParameter.add_override_value( { "smart-class-parameter-id": sc_param_id, "match": "domain=test.com", "value": value, "use-puppet-default": 1, } ) sc_param = SmartClassParameter.info({"puppet-class": "ntp", "id": sc_param_id}) self.assertEqual(sc_param["override-values"]["values"]["1"]["match"], "domain=test.com") self.assertEqual(sc_param["override-values"]["values"]["1"]["value"], value)
def test_positive_validate_default_value_required_check(self): """No error raised for non-empty default Value - Required check. @id: 812aceb8-8d5e-4374-bf73-61d7085ee510 @steps: 1. Override the parameter. 2. Provide some default value, Not empty. 3. Set '--required' check. 4. Submit the change. @assert: No error raised for non-empty default value """ sc_param_id = self.sc_params_ids_list.pop() SmartClassParameter.update({ 'parameter-type': 'boolean', 'id': sc_param_id, 'default-value': u'true', 'override': 1, 'required': 1 }) sc_param = SmartClassParameter.info({ 'puppet-class': self.puppet_class['name'], 'id': sc_param_id, }) self.assertEqual(sc_param['required'], True) self.assertEqual(sc_param['default-value'], True)
def test_negative_validate_matcher_value_with_list(self): """Error raised for matcher value not in list. @id: 6e02c3f2-40aa-49ec-976d-7a12f5fa1e04 @steps: 1. Override the parameter. 2. Create a matcher with value that doesn't match the list of step 3. 3. Validate this value with list validator type and rule. 4. Submit the change. @assert: Error raised for matcher value not in list. """ sc_param_id = self.sc_params_ids_list.pop() SmartClassParameter.add_override_value( {"smart-class-parameter-id": sc_param_id, "match": "domain=test.com", "value": "myexample"} ) with self.assertRaises(CLIReturnCodeError): SmartClassParameter.update( { "id": sc_param_id, "default-value": "50", "override": 1, "validator-type": "list", "validator-rule": "25, example, 50", } ) sc_param = SmartClassParameter.info({"puppet-class": "ntp", "id": sc_param_id}) self.assertNotEqual(sc_param["default-value"], "50")
def test_positive_validate_matcher_value_with_list(self): """Error not raised for matcher value in list. @id: 16927050-0bf2-4cbd-bb34-43c669f81304 @steps: 1. Override the parameter. 2. Create a matcher with value that matches the list of step 3. 3. Validate this value with list validator type and rule. 4. Submit the change. @assert: Error not raised for matcher value in list. """ sc_param_id = self.sc_params_ids_list.pop() SmartClassParameter.add_override_value( {"smart-class-parameter-id": sc_param_id, "match": "domain=test.com", "value": "30"} ) SmartClassParameter.update( { "id": sc_param_id, "default-value": "example", "override": 1, "validator-type": "list", "validator-rule": "test, example, 30", } ) sc_param = SmartClassParameter.info({"puppet-class": "ntp", "id": sc_param_id}) self.assertEqual(sc_param["default-value"], "example")
def test_positive_validate_default_value_with_list(self): """Error not raised for default value in list. @id: b03708e8-e597-40fb-bb24-a1ac87475846 @steps: 1. Override the parameter. 2. Provide default value that matches the list of step 3. 3. Validate this value with list validator type and rule. 4. Submit the change. @assert: Error not raised for default value in list. """ sc_param_id = self.sc_params_ids_list.pop() SmartClassParameter.update( { "id": sc_param_id, "default-value": "test", "override": 1, "validator-type": "list", "validator-rule": "5, test", } ) sc_param = SmartClassParameter.info({"puppet-class": "ntp", "id": sc_param_id}) self.assertEqual(sc_param["default-value"], "test") self.assertEqual(sc_param["validator"]["type"], "list") self.assertEqual(sc_param["validator"]["rule"], "5, test")
def test_negative_validate_default_value_with_list(self): """Error raised for default value not in list. @id: cdcafbea-612e-4b60-90de-fa0c76442bbe @steps: 1. Override the parameter. 2. Provide default value that doesn't matches the list of step 3. 3. Validate this value with list validator type and rule. 4. Submit the change. @assert: Error raised for default value not in list. """ value = gen_string("alphanumeric") sc_param_id = self.sc_params_ids_list.pop() with self.assertRaises(CLIReturnCodeError): SmartClassParameter.update( { "id": sc_param_id, "default-value": value, "override": 1, "validator-type": "list", "validator-rule": "5, test", } ) sc_param = SmartClassParameter.info({"puppet-class": "ntp", "id": sc_param_id}) self.assertNotEqual(sc_param["default-value"], value)
def test_positive_validate_matcher_value_with_regex(self): """Error not raised for matcher value matching with regex. @id: 2c8273aa-e621-4d4e-b03e-f8d50a596bc2 @steps: 1. Override the parameter. 2. Create a matcher with value that matches the regex of step 3. 3. Validate this value with regex validator type and rule. 4. Submit the change. @assert: Error not raised for matcher value matching with regex. """ value = gen_string("numeric") sc_param_id = self.sc_params_ids_list.pop() SmartClassParameter.add_override_value( {"smart-class-parameter-id": sc_param_id, "match": "domain=test.com", "value": gen_string("numeric")} ) SmartClassParameter.update( { "id": sc_param_id, "default-value": value, "override": 1, "validator-type": "regexp", "validator-rule": "[0-9]", } ) sc_param = SmartClassParameter.info({"puppet-class": "ntp", "id": sc_param_id}) self.assertEqual(sc_param["default-value"], value)
def test_positive_override(self): """Override the Default Parameter value. :id: 25e34bac-084c-4b68-a082-822633e19f7e :steps: 1. Override the parameter. 2. Set the new valid Default Value. 3. Set puppet default value to 'Use Puppet Default'. 4. Submit the changes. :expectedresults: Parameter Value overridden with new value. :CaseImportance: Medium """ sc_param_id = self.sc_params_ids_list.pop() value = gen_string('alpha') SmartClassParameter.update( {'default-value': value, 'omit': 1, 'id': sc_param_id, 'override': 1} ) sc_param = SmartClassParameter.info( {'puppet-class': self.puppet_class['name'], 'id': sc_param_id} ) self.assertEqual(sc_param['default-value'], value) self.assertEqual(sc_param['omit'], True)
def test_positive_hide_parameter_default_value(self): """Hide the default value of parameter. @id: a1e206ae-67dc-48f0-886e-d543c682af34 @steps: 1. Set the override flag for the parameter. 2. Set some valid default value. 3. Set 'Hidden Value' to true. @assert: The 'hidden value' set to true for that parameter. """ sc_param_id = self.sc_params_ids_list.pop() SmartClassParameter.update({ 'id': sc_param_id, 'override': 1, 'default-value': gen_string('alpha'), 'hidden-value': 1, }) sc_param = SmartClassParameter.info({ 'puppet-class': self.puppet_class['name'], 'id': sc_param_id, }) self.assertEqual(sc_param['hidden-value?'], True)
def test_negative_update_parameter_type(self): """Negative Parameter Update for parameter types - Invalid Value. Types - string, boolean, integer, real, array, hash, yaml, json @id: 5c2c859a-8164-4733-8b41-d37f333656c7 @steps: 1. Override the parameter. 2. Update the Key Type. 3. Enter an 'Invalid' default Value. 3. Submit the changes. @assert: 1. Parameter not updated with string type for invalid value. 2. Error raised for invalid default value. """ sc_param_id = self.sc_params_ids_list.pop() for test_data in invalid_sc_parameters_data(): with self.subTest(test_data): with self.assertRaises(CLIReturnCodeError): SmartClassParameter.update({ 'parameter-type': test_data['sc_type'], 'default-value': test_data['value'], 'id': sc_param_id, 'override': 1, }) sc_param = SmartClassParameter.info({ 'puppet-class': self.puppet_class['name'], 'id': sc_param_id, }) self.assertNotEqual( sc_param['default-value'], test_data['value'])
def test_positive_unhide_parameter_default_value(self): """Unhide the default value of parameter. @id: 3daf662f-a0dd-469c-8088-262bfaa5246a @steps: 1. Set the override flag for the parameter. 2. Set some valid default value. 3. Set 'Hidden Value' to true and submit. 4. After hiding, set the 'Hidden Value' to false. @assert: The 'hidden value' set to false for that parameter. """ sc_param_id = self.sc_params_ids_list.pop() SmartClassParameter.update({ 'id': sc_param_id, 'override': 1, 'default-value': gen_string('alpha'), 'hidden-value': 1, }) sc_param = SmartClassParameter.info({ 'puppet-class': self.puppet_class['name'], 'id': sc_param_id, }) self.assertEqual(sc_param['hidden-value?'], True) SmartClassParameter.update({ 'id': sc_param_id, 'hidden-value': 0, }) sc_param = SmartClassParameter.info({ 'puppet-class': self.puppet_class['name'], 'id': sc_param_id, }) self.assertEqual(sc_param['hidden-value?'], False)
def test_positive_validate_matcher_value_required_check(self): """Error not raised for matcher Value - Required check. @id: e62c3c5a-d900-44d4-9793-2c17202974e5 @steps: 1. Override the parameter. 2. Create a matcher for Parameter for some attribute. 3. Provide some Value for matcher. 4. Set '--required' check. 5. Submit the change. @assert: Error not raised for matcher value. """ sc_param_id = self.sc_params_ids_list.pop() SmartClassParameter.add_override_value({ 'smart-class-parameter-id': sc_param_id, 'match': 'domain=example.com', 'value': gen_string('alpha') }) SmartClassParameter.update({ 'id': sc_param_id, 'override': 1, 'required': 1 }) sc_param = SmartClassParameter.info({ 'puppet-class': self.puppet_class['name'], 'id': sc_param_id, }) self.assertEqual(sc_param['required'], True)
def test_positive_hide_empty_default_value(self): """Hiding the empty default value. @id: 31069fff-c6d5-42b6-94f2-9551057eb15b @steps: 1. Set the override flag for the parameter. 2. Don't set any default value/Set empty value. 3. Set 'Hidden Value' to true and submit. @assert: 1. The 'hidden value' set to true for that parameter. 2. The default value is still empty on hide. """ sc_param_id = self.sc_params_ids_list.pop() SmartClassParameter.update({ 'id': sc_param_id, 'override': 1, 'hidden-value': 1, 'default-value': '', }) sc_param = SmartClassParameter.info({ 'puppet-class': self.puppet_class['name'], 'id': sc_param_id, }) self.assertFalse(sc_param['default-value']) self.assertEqual(sc_param['hidden-value?'], True)
def test_positive_validate_default_value_with_regex(self): """Error not raised for default value matching with regex. @id: 74666d12-e3be-46c1-8bd5-18d86dcf7f4b @steps: 1. Override the parameter. 2. Provide default value that matches the regex of step 3. 3. Validate this value with regex validator type and rule. 4. Submit the change. @assert: Error not raised for default value matching with regex. """ value = gen_string('numeric') sc_param_id = self.sc_params_ids_list.pop() SmartClassParameter.update({ 'id': sc_param_id, 'default-value': value, 'override': 1, 'validator-type': 'regexp', 'validator-rule': '[0-9]', }) sc_param = SmartClassParameter.info({ 'puppet-class': self.puppet_class['name'], 'id': sc_param_id, }) self.assertEqual(sc_param['default-value'], value) self.assertEqual(sc_param['validator']['type'], 'regexp') self.assertEqual(sc_param['validator']['rule'], '[0-9]')
def test_positive_list_parameters_by_host_name(self): """List all the parameters included in specific Host by its name. @id: a8165746-3480-4875-8931-b20ebec241dc @assert: Parameters listed for specific Host. @CaseLevel: Integration """ sc_param_id = self.sc_params_ids_list.pop() SmartClassParameter.update({ 'id': sc_param_id, 'override': 1, }) sc_param = SmartClassParameter.info({ 'puppet-class': self.puppet_class['name'], 'id': sc_param_id, }) self.assertEqual(sc_param['override'], True) host = entities.Host(organization=self.org['id']).create() Host.update({ u'name': host.name, u'environment': self.env['name'], u'puppet-classes': self.puppet_class['name'], }) host_sc_params_list = Host.sc_params({u'host': host.name}) self.assertGreater(len(host_sc_params_list), 0)
def test_positive_validate_matcher_value_with_regex(self): """Error not raised for matcher value matching with regex. @id: 2c8273aa-e621-4d4e-b03e-f8d50a596bc2 @steps: 1. Override the parameter. 2. Create a matcher with value that matches the regex of step 3. 3. Validate this value with regex validator type and rule. 4. Submit the change. @assert: Error not raised for matcher value matching with regex. """ value = gen_string('numeric') sc_param_id = self.sc_params_ids_list.pop() SmartClassParameter.add_override_value({ 'smart-class-parameter-id': sc_param_id, 'match': 'domain=test.com', 'value': gen_string('numeric') }) SmartClassParameter.update({ 'id': sc_param_id, 'default-value': value, 'override': 1, 'validator-type': 'regexp', 'validator-rule': '[0-9]', }) sc_param = SmartClassParameter.info({ 'puppet-class': self.puppet_class['name'], 'id': sc_param_id, }) self.assertEqual(sc_param['default-value'], value)
def test_positive_list_parameters_by_host_id(self): """List all the parameters included in specific Host by its id. @id: 79050de6-b894-4a88-b155-32bf488b692c @assert: Parameters listed for specific Host. @CaseLevel: Integration """ sc_param_id = self.sc_params_ids_list.pop() SmartClassParameter.update({ 'id': sc_param_id, 'override': 1, }) sc_param = SmartClassParameter.info({ 'puppet-class': 'ntp', 'id': sc_param_id, }) self.assertEqual(sc_param['override'], True) host = entities.Host(organization=self.org['id']).create() Host.update({ u'name': host.name, u'environment': self.env['name'], u'puppet-classes': self.puppet_class['name'], }) host_sc_params_list = Host.sc_params({u'host-id': host.id}) self.assertGreater(len(host_sc_params_list), 0)
def test_positive_validate_default_value_with_list(self): """Error not raised for default value in list. @id: b03708e8-e597-40fb-bb24-a1ac87475846 @steps: 1. Override the parameter. 2. Provide default value that matches the list of step 3. 3. Validate this value with list validator type and rule. 4. Submit the change. @assert: Error not raised for default value in list. """ sc_param_id = self.sc_params_ids_list.pop() SmartClassParameter.update({ 'id': sc_param_id, 'default-value': 'test', 'override': 1, 'validator-type': 'list', 'validator-rule': '5, test', }) sc_param = SmartClassParameter.info({ 'puppet-class': self.puppet_class['name'], 'id': sc_param_id, }) self.assertEqual(sc_param['default-value'], 'test') self.assertEqual(sc_param['validator']['type'], 'list') self.assertEqual(sc_param['validator']['rule'], '5, test')
def test_positive_list_parameters_by_hostgroup_name(self): """List all the parameters included in specific HostGroup by its name. @id: a2a01ca7-4dd2-4db6-a654-a632864998d9 @assert: Parameters listed for specific HostGroup. @CaseLevel: Integration """ sc_param_id = self.sc_params_ids_list.pop() SmartClassParameter.update({ 'id': sc_param_id, 'override': 1, }) sc_param = SmartClassParameter.info({ 'puppet-class': 'ntp', 'id': sc_param_id, }) self.assertEqual(sc_param['override'], True) hostgroup = make_hostgroup({ 'environment-id': self.env['id'], 'puppet-class-ids': self.puppet_class['id'] }) hostgroup_sc_params = HostGroup.sc_params({ u'hostgroup': hostgroup['name']}) self.assertGreater(len(hostgroup_sc_params), 0)
def test_positive_validate_matcher_value_with_list(self): """Error not raised for matcher value in list. @id: 16927050-0bf2-4cbd-bb34-43c669f81304 @steps: 1. Override the parameter. 2. Create a matcher with value that matches the list of step 3. 3. Validate this value with list validator type and rule. 4. Submit the change. @assert: Error not raised for matcher value in list. """ sc_param_id = self.sc_params_ids_list.pop() SmartClassParameter.add_override_value({ 'smart-class-parameter-id': sc_param_id, 'match': 'domain=test.com', 'value': '30' }) SmartClassParameter.update({ 'id': sc_param_id, 'default-value': 'example', 'override': 1, 'validator-type': 'list', 'validator-rule': 'test, example, 30', }) sc_param = SmartClassParameter.info({ 'puppet-class': self.puppet_class['name'], 'id': sc_param_id, }) self.assertEqual(sc_param['default-value'], 'example')
def test_positive_list_parameters_by_hostgroup_id(self): """List all the parameters included in specific HostGroup by id. @id: 80c1058d-b87d-4c09-957f-7d3daacdedf4 @assert: Parameters listed for specific HostGroup. @CaseLevel: Integration """ sc_param_id = self.sc_params_ids_list.pop() SmartClassParameter.update({ 'id': sc_param_id, 'override': 1, }) sc_param = SmartClassParameter.info({ 'puppet-class': 'ntp', 'id': sc_param_id, }) self.assertEqual(sc_param['override'], True) hostgroup = make_hostgroup({ 'environment-id': self.env['id'], 'puppet-class-ids': self.puppet_class['id'] }) hostgroup_sc_params = HostGroup.sc_params({ u'hostgroup-id': hostgroup['id']}) self.assertGreater(len(hostgroup_sc_params), 0)
def test_negative_validate_matcher_and_default_value(self): """Error for invalid default and matcher value both at a time. @id: 07dfcdad-e619-4672-9fe8-75a8352e44a4 @steps: 1. Override the parameter. 2. Update parameter default type with Invalid value. 3. Create a matcher with value that doesn't matches the default type. 4. Attempt to submit the change. @assert: Error raised for invalid default and matcher value both. """ sc_param_id = self.sc_params_ids_list.pop() SmartClassParameter.add_override_value({ 'smart-class-parameter-id': sc_param_id, 'match': 'domain=test.com', 'value': gen_string('alpha'), }) with self.assertRaises(CLIReturnCodeError): SmartClassParameter.update({ 'id': sc_param_id, 'parameter-type': 'boolean', 'override': 1, 'default-value': gen_string('alpha'), })
def test_positive_override(self): """Override the Default Parameter value. @id: 25e34bac-084c-4b68-a082-822633e19f7e @steps: 1. Override the parameter. 2. Set the new valid Default Value. 3. Submit the changes. @assert: Parameter Value overridden with new value. """ sc_param_id = self.sc_params_ids_list.pop() value = gen_string('alpha') SmartClassParameter.update({ 'default-value': value, 'id': sc_param_id, 'override': 1, }) sc_param = SmartClassParameter.info({ 'puppet-class': 'ntp', 'id': sc_param_id, }) self.assertEqual(sc_param['default-value'], value)
def test_negative_validate_matcher_value_with_regex(self): """Error raised for matcher value not matching with regex. @id: b8b2f1c2-a20c-42d6-a687-79e6eee0268e @steps: 1. Override the parameter. 2. Create a matcher with value that doesn't match the regex of step 3. 3. Validate this value with regex validator type and rule. 4. Submit the change. @assert: Error raised for matcher value not matching with regex. """ value = gen_string("numeric") sc_param_id = self.sc_params_ids_list.pop() SmartClassParameter.add_override_value( {"smart-class-parameter-id": sc_param_id, "match": "domain=test.com", "value": gen_string("alpha")} ) with self.assertRaises(CLIReturnCodeError): SmartClassParameter.update( { "id": sc_param_id, "default-value": value, "override": 1, "validator-type": "regexp", "validator-rule": "[0-9]", } ) sc_param = SmartClassParameter.info({"puppet-class": "ntp", "id": sc_param_id}) self.assertNotEqual(sc_param["default-value"], value)
def test_negative_override(self, module_sc_params): """Override the Default Parameter value - override Unchecked. :id: eb24c44d-0e34-40a3-aa3e-05a3cd4ed1ea :steps: 1. Don't override the parameter. 2. Set the new valid Default Value. 3. Attempt to submit the changes. :expectedresults: Not overridden parameter value cannot be updated. :BZ: 1830834 :customerscenario: true :CaseImportance: Medium """ sc_param_id = module_sc_params['ids'].pop() with pytest.raises(CLIReturnCodeError): SmartClassParameter.update({ 'default-value': gen_string('alpha'), 'id': sc_param_id })
def test_positive_list_scparams_by_name(self): """List all smart class parameters using hostgroup name :id: 8e4fc561-2446-4a89-989b-e6814973aa56 :expectedresults: Overridden sc-param from puppet class is listed :CaseLevel: Integration """ # Create hostgroup with associated puppet class hostgroup = make_hostgroup({ 'puppet-classes': self.puppet_classes[0]['name'], 'environment': self.env['name'], 'content-view': self.cv['name'], 'query-organization': self.org['name'], }) # Override one of the sc-params from puppet class sc_params_list = SmartClassParameter.list({ 'environment': self.env['name'], 'search': u'puppetclass="{0}"'.format(self.puppet_classes[0]['name']) }) scp_id = choice(sc_params_list)['id'] SmartClassParameter.update({'id': scp_id, 'override': 1}) # Verify that affected sc-param is listed hg_scparams = HostGroup.sc_params({'hostgroup': hostgroup['name']}) self.assertIn(scp_id, [scp['id'] for scp in hg_scparams])
def test_positive_validate_default_value_with_list(self, module_puppet, module_sc_params): """Error not raised for default value in list and required :id: b03708e8-e597-40fb-bb24-a1ac87475846 :steps: 1. Override the parameter. 2. Provide default value that matches the list of step 3. 3. Validate this value with list validator type and rule. 4. Submit the change. :expectedresults: Error not raised for default value in list. :BZ: 1830834 :CaseImportance: Medium """ sc_param_id = module_sc_params['ids'].pop() SmartClassParameter.update( { 'id': sc_param_id, 'default-value': 'test', 'override': 1, 'validator-type': 'list', 'validator-rule': '5, test', 'required': 1, } ) sc_param = SmartClassParameter.info( {'puppet-class': module_puppet['class']['name'], 'id': sc_param_id} ) assert sc_param['default-value'] == 'test' assert sc_param['validator']['type'] == 'list' assert sc_param['validator']['rule'] == '5, test'
def test_negative_validate_default_value_with_list(self, module_puppet, module_sc_params): """Error raised for default value not in list. :id: cdcafbea-612e-4b60-90de-fa0c76442bbe :steps: 1. Override the parameter. 2. Provide default value that doesn't matches the list of step 3. 3. Validate this value with list validator type and rule. 4. Submit the change. :expectedresults: Error raised for default value not in list. :CaseImportance: Medium """ value = gen_string('alphanumeric') sc_param_id = module_sc_params['ids'].pop() with pytest.raises(CLIReturnCodeError): SmartClassParameter.update( { 'id': sc_param_id, 'default-value': value, 'override': 1, 'validator-type': 'list', 'validator-rule': '5, test', } ) sc_param = SmartClassParameter.info( {'puppet-class': module_puppet['class']['name'], 'id': sc_param_id} ) assert sc_param['default-value'] != value
def test_positive_create_matcher_puppet_default_value(self, module_puppet, module_sc_params): """Create matcher for attribute in parameter, Where Value is puppet default value. :id: c08fcf25-e5c7-411e-beed-3741a24496fd :steps: 1. Override the parameter. 2. Set some default Value. 3. Create matcher with valid attribute type, name and puppet default value. 4. Submit the change. :expectedresults: The matcher has been created successfully. :CaseImportance: Medium """ sc_param_id = module_sc_params['ids'].pop() SmartClassParameter.update( {'id': sc_param_id, 'override': 1, 'default-value': gen_string('alpha')} ) SmartClassParameter.add_matcher( {'smart-class-parameter-id': sc_param_id, 'match': 'domain=test.com', 'omit': 1} ) sc_param = SmartClassParameter.info( {'puppet-class': module_puppet['class']['name'], 'id': sc_param_id} ) assert sc_param['override-values']['values']['1']['match'] == 'domain=test.com'
def test_positive_override(self, module_puppet, module_sc_params): """Override the Default Parameter value. :id: 25e34bac-084c-4b68-a082-822633e19f7e :steps: 1. Override the parameter. 2. Set the new valid Default Value. 3. Set puppet default value to 'Use Puppet Default'. 4. Submit the changes. :expectedresults: Parameter Value overridden with new value. :BZ: 1830834 :CaseImportance: Medium """ sc_param_id = module_sc_params['ids'].pop() value = gen_string('alpha') SmartClassParameter.update( {'default-value': value, 'omit': 1, 'id': sc_param_id, 'override': 1} ) sc_param = SmartClassParameter.info( {'puppet-class': module_puppet['class']['name'], 'id': sc_param_id} ) assert sc_param['default-value'] == value assert sc_param['omit'] is True
def test_positive_validate_matcher_value_required_check(self): """Error not raised for matcher Value - Required check. @id: e62c3c5a-d900-44d4-9793-2c17202974e5 @steps: 1. Override the parameter. 2. Create a matcher for Parameter for some attribute. 3. Provide some Value for matcher. 4. Set '--required' check. 5. Submit the change. @assert: Error not raised for matcher value. """ sc_param_id = self.sc_params_ids_list.pop() SmartClassParameter.add_override_value({ 'smart-class-parameter-id': sc_param_id, 'match': 'domain=example.com', 'value': gen_string('alpha') }) SmartClassParameter.update({ 'id': sc_param_id, 'override': 1, 'required': 1 }) sc_param = SmartClassParameter.info({ 'puppet-class': 'ntp', 'id': sc_param_id, }) self.assertEqual(sc_param['required'], True)
def test_positive_list_scparams_by_id(self): """List all overridden smart class parameters using hostgroup id :id: 42a24060-2ed7-427e-8396-86d73bbe5f69 :expectedresults: Overridden sc-param from puppet class is listed :Caselevel: Integration """ # Create hostgroup with associated puppet class hostgroup = make_hostgroup({ 'puppet-classes': self.puppet_class['name'], 'environment': self.env['name'], 'content-view': self.cv['name'], 'query-organization': self.org['name'], }) # Override one of the sc-params from puppet class sc_params_list = SmartClassParameter.list({ 'environment': self.env['name'], 'search': u'puppetclass="{0}"'.format(self.puppet_class['name']) }) scp_id = choice(sc_params_list)['id'] SmartClassParameter.update({'id': scp_id, 'override': 1}) # Verify that affected sc-param is listed hg_scparams = HostGroup.sc_params({'hostgroup-id': hostgroup['id']}) self.assertIn(scp_id, [scp['id'] for scp in hg_scparams])
def test_positive_list_parameters_by_hostgroup_id(self): """List all the parameters included in specific HostGroup by id. @id: 80c1058d-b87d-4c09-957f-7d3daacdedf4 @assert: Parameters listed for specific HostGroup. @CaseLevel: Integration """ sc_param_id = self.sc_params_ids_list.pop() SmartClassParameter.update({ 'id': sc_param_id, 'override': 1, }) sc_param = SmartClassParameter.info({ 'puppet-class': 'ntp', 'id': sc_param_id, }) self.assertEqual(sc_param['override'], True) hostgroup = make_hostgroup({ 'environment-id': self.env['id'], 'puppet-class-ids': self.puppet['id'] }) hostgroup_sc_params = HostGroup.sc_params( {u'hostgroup-id': hostgroup['id']}) self.assertGreater(len(hostgroup_sc_params), 0)
def test_positive_list_parameters_by_hostgroup_name(self): """List all the parameters included in specific HostGroup by its name. @id: a2a01ca7-4dd2-4db6-a654-a632864998d9 @assert: Parameters listed for specific HostGroup. @CaseLevel: Integration """ sc_param_id = self.sc_params_ids_list.pop() SmartClassParameter.update({ 'id': sc_param_id, 'override': 1, }) sc_param = SmartClassParameter.info({ 'puppet-class': 'ntp', 'id': sc_param_id, }) self.assertEqual(sc_param['override'], True) hostgroup = make_hostgroup({ 'environment-id': self.env['id'], 'puppet-class-ids': self.puppet['id'] }) hostgroup_sc_params = HostGroup.sc_params( {u'hostgroup': hostgroup['name']}) self.assertGreater(len(hostgroup_sc_params), 0)
def test_positive_hide_empty_default_value(self): """Hiding the empty default value. @id: 31069fff-c6d5-42b6-94f2-9551057eb15b @steps: 1. Set the override flag for the parameter. 2. Don't set any default value/Set empty value. 3. Set 'Hidden Value' to true and submit. @assert: 1. The 'hidden value' set to true for that parameter. 2. The default value is still empty on hide. """ sc_param_id = self.sc_params_ids_list.pop() SmartClassParameter.update({ 'id': sc_param_id, 'override': 1, 'hidden-value': 1, 'default-value': '', }) sc_param = SmartClassParameter.info({ 'puppet-class': 'ntp', 'id': sc_param_id, }) self.assertFalse(sc_param['default-value']) self.assertEqual(sc_param['hidden-value?'], True)
def test_positive_unhide_parameter_default_value(self): """Unhide the default value of parameter. @id: 3daf662f-a0dd-469c-8088-262bfaa5246a @steps: 1. Set the override flag for the parameter. 2. Set some valid default value. 3. Set 'Hidden Value' to true and submit. 4. After hiding, set the 'Hidden Value' to false. @assert: The 'hidden value' set to false for that parameter. """ sc_param_id = self.sc_params_ids_list.pop() SmartClassParameter.update({ 'id': sc_param_id, 'override': 1, 'default-value': gen_string('alpha'), 'hidden-value': 1, }) sc_param = SmartClassParameter.info({ 'puppet-class': 'ntp', 'id': sc_param_id, }) self.assertEqual(sc_param['hidden-value?'], True) SmartClassParameter.update({ 'id': sc_param_id, 'hidden-value': 0, }) sc_param = SmartClassParameter.info({ 'puppet-class': 'ntp', 'id': sc_param_id, }) self.assertEqual(sc_param['hidden-value?'], False)
def test_positive_validate_default_value_required_check(self): """No error raised for non-empty default Value - Required check. @id: 812aceb8-8d5e-4374-bf73-61d7085ee510 @steps: 1. Override the parameter. 2. Provide some default value, Not empty. 3. Set '--required' check. 4. Submit the change. @assert: No error raised for non-empty default value """ sc_param_id = self.sc_params_ids_list.pop() SmartClassParameter.update({ 'parameter-type': 'boolean', 'id': sc_param_id, 'default-value': u'true', 'override': 1, 'required': 1 }) sc_param = SmartClassParameter.info({ 'puppet-class': 'ntp', 'id': sc_param_id, }) self.assertEqual(sc_param['required'], True) self.assertEqual(sc_param['default-value'], True)
def test_positive_validate_default_value_with_regex(self): """Error not raised for default value matching with regex. @id: 74666d12-e3be-46c1-8bd5-18d86dcf7f4b @steps: 1. Override the parameter. 2. Provide default value that matches the regex of step 3. 3. Validate this value with regex validator type and rule. 4. Submit the change. @assert: Error not raised for default value matching with regex. """ value = gen_string('numeric') sc_param_id = self.sc_params_ids_list.pop() SmartClassParameter.update({ 'id': sc_param_id, 'default-value': value, 'override': 1, 'validator-type': 'regexp', 'validator-rule': '[0-9]', }) sc_param = SmartClassParameter.info({ 'puppet-class': 'ntp', 'id': sc_param_id, }) self.assertEqual(sc_param['default-value'], value) self.assertEqual(sc_param['validator']['type'], 'regexp') self.assertEqual(sc_param['validator']['rule'], '[0-9]')
def test_negative_validate_matcher_value_with_regex(self): """Error raised for matcher value not matching with regex. @id: b8b2f1c2-a20c-42d6-a687-79e6eee0268e @steps: 1. Override the parameter. 2. Create a matcher with value that doesn't match the regex of step 3. 3. Validate this value with regex validator type and rule. 4. Submit the change. @assert: Error raised for matcher value not matching with regex. """ value = gen_string('numeric') sc_param_id = self.sc_params_ids_list.pop() SmartClassParameter.add_override_value({ 'smart-class-parameter-id': sc_param_id, 'match': 'domain=test.com', 'value': gen_string('alpha') }) with self.assertRaises(CLIReturnCodeError): SmartClassParameter.update({ 'id': sc_param_id, 'default-value': value, 'override': 1, 'validator-type': 'regexp', 'validator-rule': '[0-9]', }) sc_param = SmartClassParameter.info({ 'puppet-class': 'ntp', 'id': sc_param_id, }) self.assertNotEqual(sc_param['default-value'], value)
def test_positive_validate_matcher_value_with_default_type(self): """No error for matcher value of default type. @id: a247adac-4631-4b90-ae4a-a768cd05be34 @steps: 1. Override the parameter. 2. Update parameter default type with valid value. 3. Create a matcher with value that matches the default type. 4. Submit the change. @assert: Error not raised for matcher value of default type. """ sc_param_id = self.sc_params_ids_list.pop() SmartClassParameter.update({ 'id': sc_param_id, 'parameter-type': 'boolean', 'override': 1, 'default-value': u'true', }) SmartClassParameter.add_override_value({ 'smart-class-parameter-id': sc_param_id, 'match': 'domain=test.com', 'value': u'false' }) sc_param = SmartClassParameter.info({ 'puppet-class': 'ntp', 'id': sc_param_id, }) self.assertEqual(sc_param['override-values']['values']['1']['match'], 'domain=test.com') self.assertEqual(sc_param['override-values']['values']['1']['value'], False)
def test_negative_validate_matcher_value_with_list(self): """Error raised for matcher value not in list. @id: 6e02c3f2-40aa-49ec-976d-7a12f5fa1e04 @steps: 1. Override the parameter. 2. Create a matcher with value that doesn't match the list of step 3. 3. Validate this value with list validator type and rule. 4. Submit the change. @assert: Error raised for matcher value not in list. """ sc_param_id = self.sc_params_ids_list.pop() SmartClassParameter.add_override_value({ 'smart-class-parameter-id': sc_param_id, 'match': 'domain=test.com', 'value': 'myexample' }) with self.assertRaises(CLIReturnCodeError): SmartClassParameter.update({ 'id': sc_param_id, 'default-value': '50', 'override': 1, 'validator-type': 'list', 'validator-rule': '25, example, 50', }) sc_param = SmartClassParameter.info({ 'puppet-class': 'ntp', 'id': sc_param_id, }) self.assertNotEqual(sc_param['default-value'], '50')
def test_positive_validate_matcher_value_with_list(self): """Error not raised for matcher value in list. @id: 16927050-0bf2-4cbd-bb34-43c669f81304 @steps: 1. Override the parameter. 2. Create a matcher with value that matches the list of step 3. 3. Validate this value with list validator type and rule. 4. Submit the change. @assert: Error not raised for matcher value in list. """ sc_param_id = self.sc_params_ids_list.pop() SmartClassParameter.add_override_value({ 'smart-class-parameter-id': sc_param_id, 'match': 'domain=test.com', 'value': '30' }) SmartClassParameter.update({ 'id': sc_param_id, 'default-value': 'example', 'override': 1, 'validator-type': 'list', 'validator-rule': 'test, example, 30', }) sc_param = SmartClassParameter.info({ 'puppet-class': 'ntp', 'id': sc_param_id, }) self.assertEqual(sc_param['default-value'], 'example')
def test_negative_validate_default_value_with_list(self): """Error raised for default value not in list. @id: cdcafbea-612e-4b60-90de-fa0c76442bbe @steps: 1. Override the parameter. 2. Provide default value that doesn't matches the list of step 3. 3. Validate this value with list validator type and rule. 4. Submit the change. @assert: Error raised for default value not in list. """ value = gen_string('alphanumeric') sc_param_id = self.sc_params_ids_list.pop() with self.assertRaises(CLIReturnCodeError): SmartClassParameter.update({ 'id': sc_param_id, 'default-value': value, 'override': 1, 'validator-type': 'list', 'validator-rule': '5, test', }) sc_param = SmartClassParameter.info({ 'puppet-class': 'ntp', 'id': sc_param_id, }) self.assertNotEqual(sc_param['default-value'], value)
def test_positive_validate_default_value_with_list(self): """Error not raised for default value in list. @id: b03708e8-e597-40fb-bb24-a1ac87475846 @steps: 1. Override the parameter. 2. Provide default value that matches the list of step 3. 3. Validate this value with list validator type and rule. 4. Submit the change. @assert: Error not raised for default value in list. """ sc_param_id = self.sc_params_ids_list.pop() SmartClassParameter.update({ 'id': sc_param_id, 'default-value': 'test', 'override': 1, 'validator-type': 'list', 'validator-rule': '5, test', }) sc_param = SmartClassParameter.info({ 'puppet-class': 'ntp', 'id': sc_param_id, }) self.assertEqual(sc_param['default-value'], 'test') self.assertEqual(sc_param['validator']['type'], 'list') self.assertEqual(sc_param['validator']['rule'], '5, test')
def test_positive_validate_matcher_value_with_regex(self): """Error not raised for matcher value matching with regex. @id: 2c8273aa-e621-4d4e-b03e-f8d50a596bc2 @steps: 1. Override the parameter. 2. Create a matcher with value that matches the regex of step 3. 3. Validate this value with regex validator type and rule. 4. Submit the change. @assert: Error not raised for matcher value matching with regex. """ value = gen_string('numeric') sc_param_id = self.sc_params_ids_list.pop() SmartClassParameter.add_override_value({ 'smart-class-parameter-id': sc_param_id, 'match': 'domain=test.com', 'value': gen_string('numeric') }) SmartClassParameter.update({ 'id': sc_param_id, 'default-value': value, 'override': 1, 'validator-type': 'regexp', 'validator-rule': '[0-9]', }) sc_param = SmartClassParameter.info({ 'puppet-class': 'ntp', 'id': sc_param_id, }) self.assertEqual(sc_param['default-value'], value)
def test_positive_hide_parameter_default_value(self): """Hide the default value of parameter. @id: a1e206ae-67dc-48f0-886e-d543c682af34 @steps: 1. Set the override flag for the parameter. 2. Set some valid default value. 3. Set 'Hidden Value' to true. @assert: The 'hidden value' set to true for that parameter. """ sc_param_id = self.sc_params_ids_list.pop() SmartClassParameter.update({ 'id': sc_param_id, 'override': 1, 'default-value': gen_string('alpha'), 'hidden-value': 1, }) sc_param = SmartClassParameter.info({ 'puppet-class': 'ntp', 'id': sc_param_id, }) self.assertEqual(sc_param['hidden-value?'], True)
def test_positive_list_scparams_by_id(self): """List all overridden smart class parameters using hostgroup id :id: 42a24060-2ed7-427e-8396-86d73bbe5f69 :expectedresults: Overridden sc-param from puppet class is listed :Caselevel: Integration """ # Create hostgroup with associated puppet class hostgroup = make_hostgroup({ 'puppet-classes': self.puppet_classes[0]['name'], 'environment': self.env['name'], 'content-view': self.cv['name'], 'query-organization': self.org['name'], }) # Override one of the sc-params from puppet class sc_params_list = SmartClassParameter.list({ 'environment': self.env['name'], 'search': u'puppetclass="{0}"'.format( self.puppet_classes[0]['name']) }) scp_id = choice(sc_params_list)['id'] SmartClassParameter.update({'id': scp_id, 'override': 1}) # Verify that affected sc-param is listed hg_scparams = HostGroup.sc_params({'hostgroup-id': hostgroup['id']}) self.assertIn(scp_id, [scp['id'] for scp in hg_scparams])
def test_negative_validate_default_value_with_regex(self): """Error raised for default value not matching with regex. @id: f36ed6e8-04ef-4614-98b3-38703d8aeeb0 @steps: 1. Override the parameter. 2. Provide default value that doesn't matches the regex of step 3. 3. Validate this value with regex validator type and rule. 4. Submit the change. @assert: Error raised for default value not matching with regex. """ value = gen_string('alpha') sc_param_id = self.sc_params_ids_list.pop() with self.assertRaises(CLIReturnCodeError): SmartClassParameter.update({ 'id': sc_param_id, 'default-value': value, 'override': 1, 'validator-type': 'regexp', 'validator-rule': '[0-9]', }) sc_param = SmartClassParameter.info({ 'puppet-class': 'ntp', 'id': sc_param_id, }) self.assertNotEqual(sc_param['default-value'], value)
def test_positive_create_and_remove_matcher(self, module_puppet, module_sc_params): """Create and remove matcher for attribute in parameter. :id: 37fe299b-1e81-4faf-b1c3-2edfc3d53dc1 :steps: 1. Override the parameter. 2. Set some default Value. 3. Create a matcher with all valid values. 4. Create matcher with valid attribute type, name and puppet default value. 5. Submit the change. 6. Remove the matcher created in step 1 :expectedresults: The matcher has been created successfully. :CaseImportance: Medium """ sc_param_id = module_sc_params['ids'].pop() value = gen_string('alpha') SmartClassParameter.update({ 'id': sc_param_id, 'override': 1, 'override-value-order': 'is_virtual' }) SmartClassParameter.add_matcher({ 'smart-class-parameter-id': sc_param_id, 'match': 'is_virtual=true', 'value': value }) sc_param = SmartClassParameter.info({ 'puppet-class': module_puppet['class']['name'], 'id': sc_param_id }) assert sc_param['override-values']['values']['1'][ 'match'] == 'is_virtual=true' assert sc_param['override-values']['values']['1']['value'] == value SmartClassParameter.remove_matcher({ 'smart-class-parameter-id': sc_param_id, 'id': sc_param['override-values']['values']['1']['id'], }) sc_param = SmartClassParameter.info({ 'puppet-class': module_puppet['class']['name'], 'id': sc_param_id }) assert len(sc_param['override-values']['values']) == 0
def test_positive_list(self, module_org, module_location, module_puppet, module_sc_params): """List all the parameters included in specific elements. :id: 9fcfbe32-d388-435d-a629-6969a50a4243 :expectedresults: Parameters listed for specific Environment (by name and id), Host (name, id), Hostgroup (name, id), and puppetclass (name) :CaseImportance: Medium """ host = entities.Host( organization=module_org.id, location=module_location.id, environment=module_puppet['env']['name'], ).create() host.add_puppetclass(data={'puppetclass_id': module_puppet['class']['id']}) hostgroup = make_hostgroup( { 'environment-id': module_puppet['env']['id'], 'puppet-class-ids': module_puppet['class']['id'], } ) list_queries = [ {'environment': module_puppet['env']['name']}, {'environment-id': module_puppet['env']['id']}, {'host': host.name}, {'host-id': host.id}, {'hostgroup': hostgroup["name"]}, {'hostgroup-id': hostgroup["id"]}, {'puppet-class': module_puppet['class']['name']}, ] # override an example parameter sc_param_id = module_sc_params['ids'].pop() SmartClassParameter.update({'id': sc_param_id, 'override': 1}) sc_param = SmartClassParameter.info( {'puppet-class': module_puppet['class']['name'], 'id': sc_param_id} ) assert sc_param['override'] is True # check listing parameters for selected queries for query in list_queries: sc_params = SmartClassParameter.list(query) assert len(sc_params) > 0, f"Failed to list parameters for query: {query}" assert sc_param_id in [scp['id'] for scp in sc_params] # Check that only unique results are returned assert len(sc_params) == len( {scp['id'] for scp in sc_params} ), f'Not only unique results returned for query: {query}'
def test_positive_list(self): """List all the parameters included in specific elements. :id: 9fcfbe32-d388-435d-a629-6969a50a4243 :expectedresults: Parameters listed for specific Environment (by name and id), Host (name, id), Hostgroup (name, id), and puppetclass (name) :CaseImportance: Medium """ list_queries = [ {'environment': self.env['name']}, {'environment-id': self.env['id']}, {'host': self.host.name}, {'host-id': self.host.id}, {'hostgroup': self.hostgroup["name"]}, {'hostgroup-id': self.hostgroup["id"]}, {'puppet-class': self.puppet_class['name']}, ] # override an example parameter sc_param_id = self.sc_params_ids_list.pop() SmartClassParameter.update({'id': sc_param_id, 'override': 1}) sc_param = SmartClassParameter.info( {'puppet-class': self.puppet_class['name'], 'id': sc_param_id} ) self.assertEqual(sc_param['override'], True) # check listing parameters for selected queries for query in list_queries: with self.subTest(query): sc_params = SmartClassParameter.list(query) self.assertGreater( len(sc_params), 0, "Failed to list parameters for query: {}".format(query) ) self.assertIn(sc_param_id, [scp['id'] for scp in sc_params]) # Check that only unique results are returned self.assertEqual( len(sc_params), len({scp['id'] for scp in sc_params}), "Not only unique resutls returned for query: {}".format(query), )