def test_positive_import_force_locked_template( self, module_org, create_import_export_local_dir): """Assure locked templates are updated from repository when `force` is specified. :id: b80fbfc4-bcab-4a5d-b6c1-0e22906cd8ab :Steps: 1. Import some of the locked template specifying the `force` parameter `false`. 2. After ensuring the template is not updated, Import same locked template specifying the `force` parameter `true`. :expectedresults: 1. Assert result is {'message': 'success'} 2. With force - false, assert that locked template is not updated. 3. With force - true, assert that the locked template is updated. :CaseImportance: Medium :CaseAutomation: NotAutomated """ prefix = gen_string('alpha') _, dir_path = create_import_export_local_dir TemplateSync.imports({ 'repo': dir_path, 'prefix': prefix, 'organization-ids': module_org.id, 'lock': 'true' }) ptemplate = entities.ProvisioningTemplate().search( query={ 'per_page': 10, 'search': f'name~{prefix}', 'organization_id': module_org.id }) if ptemplate: assert ptemplate[0].read().locked update_txt = 'updated a little' ssh.command( f"echo {update_txt} >> {dir_path}/example_template.erb") TemplateSync.imports({ 'repo': dir_path, 'prefix': prefix, 'organization-id': module_org.id }) assert update_txt not in Template.dump( {'name': f'{prefix}example template'}) TemplateSync.imports({ 'repo': dir_path, 'prefix': prefix, 'organization-id': module_org.id, 'force': 'true', }) assert update_txt in Template.dump( {'name': f'{prefix}example template'}) else: pytest.fail('The template is not imported for force test')
def test_dump_template_1(self): """@Test: Check if Template can be created with specific content @Feature: Template - Create @Assert: Template is created with specific content """ content = generate_string("alpha", 10) name = generate_string("alpha", 10) new_obj = make_template( { 'name': name, 'content': content, } ) result = Template.info({'id': new_obj['id']}) self.assertEqual(result.return_code, 0) self.assertEqual(len(result.stderr), 0) self.assertEqual(new_obj['name'], result.stdout['name']) template_content = Template.dump({'id': new_obj['id']}) self.assertIn(content, template_content.stdout[0])
def test_positive_create_with_content(self): """Check if Template can be created with specific content @Feature: Template - Create @Assert: Template is created with specific content """ content = gen_string("alpha") name = gen_string("alpha") template = make_template({"content": content, "name": name}) self.assertEqual(template["name"], name) template_content = Template.dump({"id": template["id"]}) self.assertIn(content, template_content[0])
def test_positive_create_with_content(): """Check if Template can be created with specific content :id: 0fcfc46d-5e97-4451-936a-e8684acac275 :expectedresults: Template is created with specific content :CaseImportance: Critical """ content = gen_string('alpha') name = gen_string('alpha') template = make_template({'content': content, 'name': name}) assert template['name'] == name template_content = Template.dump({'id': template['id']}) assert content in template_content[0]
def test_positive_create_with_content(self): """Check if Template can be created with specific content @Feature: Template - Create @Assert: Template is created with specific content """ content = gen_string('alpha') name = gen_string('alpha') template = make_template({ 'content': content, 'name': name, }) self.assertEqual(template['name'], name) template_content = Template.dump({'id': template['id']}) self.assertIn(content, template_content[0])
def test_positive_create_with_content(self): """Check if Template can be created with specific content @id: 0fcfc46d-5e97-4451-936a-e8684acac275 @Assert: Template is created with specific content """ content = gen_string('alpha') name = gen_string('alpha') template = make_template({ 'content': content, 'name': name, }) self.assertEqual(template['name'], name) template_content = Template.dump({'id': template['id']}) self.assertIn(content, template_content[0])
def test_dump_template_1(self): """ @Test: Check if Template can be created with specific content @Feature: Template - Create @Assert: Template is created with specific content """ content = generate_string("alpha", 10) name = generate_string("alpha", 10) new_obj = make_template({ 'name': name, 'content': content, }) result = Template.info({'id': new_obj['id']}) self.assertEqual(result.return_code, 0) self.assertEqual(len(result.stderr), 0) self.assertEqual(new_obj['name'], result.stdout['name']) template_content = Template.dump({'id': new_obj['id']}) self.assertIn(content, template_content.stdout[0])