def test_positive_add_and_remove_templates(module_org): """Add and remove provisioning templates to organization :id: bd46a192-488f-4da0-bf47-1f370ae5f55c :expectedresults: Templates are handled as expected :BZ: 1845860, 1886876 :steps: 1. Add and remove template by id 2. Add and remove template by name :CaseLevel: Integration """ # create and remove templates by name name = list(valid_data_list().values())[0] template = make_template({'content': gen_string('alpha'), 'name': name}) # Add provisioning-template Org.add_provisioning_template({ 'name': module_org.name, 'provisioning-template': template['name'] }) org_info = Org.info({'name': module_org.name}) assert (f"{template['name']} ({template['type']})" in org_info['templates']), "Failed to add template by name" # Remove provisioning-template Org.remove_provisioning_template({ 'provisioning-template': template['name'], 'name': module_org.name }) org_info = Org.info({'name': module_org.name}) assert (f"{template['name']} ({template['type']})" not in org_info['templates']), "Failed to remove template by name" # add and remove templates by id # Add provisioning-template Org.add_provisioning_template({ 'provisioning-template-id': template['id'], 'id': module_org.id }) org_info = Org.info({'id': module_org.id}) assert (f"{template['name']} ({template['type']})" in org_info['templates']), "Failed to add template by name" # Remove provisioning-template Org.remove_provisioning_template({ 'provisioning-template-id': template['id'], 'id': module_org.id }) org_info = Org.info({'id': module_org.id}) assert (f"{template['name']} ({template['type']})" not in org_info['templates']), "Failed to remove template by id"
def test_positive_add_and_remove_templates(self): """Add and remove provisioning templates to organization :id: bd46a192-488f-4da0-bf47-1f370ae5f55c :expectedresults: Templates are handled as expected :steps: 1. Add and remove template by id 2. Add and remove template by name :CaseLevel: Integration """ # create and remove templates by name name = valid_data_list()[0] template = make_template({ 'content': gen_string('alpha'), 'name': name }) # Add provisioning-template Org.add_provisioning_template({ 'name': self.org['name'], 'provisioning-template': template['name'] }) org_info = Org.info({'name': self.org['name']}) self.assertIn( '{0} ({1})'.format(template['name'], template['type']), org_info['templates'], "Failed to add template by name", ) # Remove provisioning-template Org.remove_provisioning_template({ 'provisioning-template': template['name'], 'name': self.org['name'] }) org_info = Org.info({'name': self.org['name']}) self.assertNotIn( '{0} ({1})'.format(template['name'], template['type']), org_info['templates'], "Failed to remove template by name", ) # add and remove templates by id # Add provisioning-template Org.add_provisioning_template({ 'provisioning-template-id': template['id'], 'id': self.org['id'] }) org_info = Org.info({'id': self.org['id']}) self.assertIn( '{0} ({1})'.format(template['name'], template['type']), org_info['templates'], "Failed to add template by name", ) # Remove provisioning-template Org.remove_provisioning_template({ 'provisioning-template-id': template['id'], 'id': self.org['id'] }) org_info = Org.info({'id': self.org['id']}) self.assertNotIn( '{0} ({1})'.format(template['name'], template['type']), org_info['templates'], "Failed to remove template by id", )