def test_positive_remove_os_by_id(self): """Check if operating system can be removed from a template :id: b5362565-6dce-4770-81e1-4fe3ec6f6cee :expectedresults: Operating system is removed from template :CaseLevel: Integration """ template = make_template() new_os = make_os() Template.add_operatingsystem({ 'id': template['id'], 'operatingsystem-id': new_os['id'], }) template = Template.info({'id': template['id']}) os_string = '{0} {1}.{2}'.format( new_os['name'], new_os['major-version'], new_os['minor-version'] ) self.assertIn(os_string, template['operating-systems']) Template.remove_operatingsystem({ 'id': template['id'], 'operatingsystem-id': new_os['id'] }) template = Template.info({'id': template['id']}) self.assertNotIn(os_string, template['operating-systems'])
def test_positive_remove_os_by_id(self): """Check if operating system can be removed from a template @id: b5362565-6dce-4770-81e1-4fe3ec6f6cee @Assert: Operating system is removed from template @CaseLevel: Integration """ template = make_template() new_os = make_os() Template.add_operatingsystem({ 'id': template['id'], 'operatingsystem-id': new_os['id'], }) template = Template.info({'id': template['id']}) os_string = '{0} {1}.{2}'.format( new_os['name'], new_os['major-version'], new_os['minor-version'] ) self.assertIn(os_string, template['operating-systems']) Template.remove_operatingsystem({ 'id': template['id'], 'operatingsystem-id': new_os['id'] }) template = Template.info({'id': template['id']}) self.assertNotIn(os_string, template['operating-systems'])
def test_positive_remove_os_by_id(module_os_with_minor): """Check if operating system can be removed from a template :id: b5362565-6dce-4770-81e1-4fe3ec6f6cee :expectedresults: Operating system is removed from template :CaseLevel: Integration :CaseImportance: Medium :BZ: 1395229 """ template = make_template() Template.add_operatingsystem( {'id': template['id'], 'operatingsystem-id': module_os_with_minor.id} ) template = Template.info({'id': template['id']}) os_string = ( f'{module_os_with_minor.name} {module_os_with_minor.major}.{module_os_with_minor.minor}' ) assert os_string in template['operating-systems'] Template.remove_operatingsystem( {'id': template['id'], 'operatingsystem-id': module_os_with_minor.id} ) template = Template.info({'id': template['id']}) assert os_string not in template['operating-systems']
def test_remove_operating_system_1(self): """@Test: Check if OS can be removed Template @Feature: Template - Remove Operating System @Assert: Template no longer has an operating system """ template = make_template() new_os = make_os() Template.add_operatingsystem({ 'id': template['id'], 'operatingsystem-id': new_os['id'], }) template = Template.info({'id': template['id']}) os_string = '{0} {1}.{2}'.format( new_os['name'], new_os['major-version'], new_os['minor-version'] ) self.assertIn(os_string, template['operating-systems']) Template.remove_operatingsystem({ 'id': template['id'], 'operatingsystem-id': new_os['id'] }) template = Template.info({'id': template['id']}) self.assertNotIn(os_string, template['operating-systems'])
def test_positive_remove_os_by_id(self): """Check if operating system can be removed from a template @Feature: Template - Remove Operating System @Assert: Operating system is removed from template """ template = make_template() new_os = make_os() Template.add_operatingsystem({"id": template["id"], "operatingsystem-id": new_os["id"]}) template = Template.info({"id": template["id"]}) os_string = "{0} {1}.{2}".format(new_os["name"], new_os["major-version"], new_os["minor-version"]) self.assertIn(os_string, template["operating-systems"]) Template.remove_operatingsystem({"id": template["id"], "operatingsystem-id": new_os["id"]}) template = Template.info({"id": template["id"]}) self.assertNotIn(os_string, template["operating-systems"])
def test_remove_operating_system_1(self): """@Test: Check if OS can be removed Template @Feature: Template - Remove Operating System @Assert: Template no longer has an operating system """ content = generate_string("alpha", 10) name = generate_string("alpha", 10) try: new_obj = make_template( { 'name': name, 'content': content, } ) new_os = make_os() except CLIFactoryError as e: self.fail(e) result = Template.add_operatingsystem( { "id": new_obj["id"], "operatingsystem-id": new_os["id"] } ) self.assertEqual(result.return_code, 0) self.assertEqual(len(result.stderr), 0) result = Template.info({'id': new_obj['id']}) self.assertEqual(result.return_code, 0) self.assertEqual(len(result.stderr), 0) os_string = "%s %s.%s" % ( new_os['name'], new_os['major'], new_os['minor'] ) self.assertIn(os_string, result.stdout['operating-systems']) result = Template.remove_operatingsystem( { "id": new_obj["id"], "operatingsystem-id": new_os["id"] } ) self.assertEqual(result.return_code, 0) self.assertEqual(len(result.stderr), 0) result = Template.info({'id': new_obj['id']}) self.assertEqual(result.return_code, 0) self.assertEqual(len(result.stderr), 0) os_string = "%s %s.%s" % ( new_os['name'], new_os['major'], new_os['minor'] ) self.assertNotIn(os_string, result.stdout['operating-systems'])
def test_positive_remove_os_by_id(self): """Check if operating system can be removed from a template @Feature: Template - Remove Operating System @Assert: Operating system is removed from template """ template = make_template() new_os = make_os() Template.add_operatingsystem({ 'id': template['id'], 'operatingsystem-id': new_os['id'], }) template = Template.info({'id': template['id']}) os_string = '{0} {1}.{2}'.format( new_os['name'], new_os['major-version'], new_os['minor-version'] ) self.assertIn(os_string, template['operating-systems']) Template.remove_operatingsystem({ 'id': template['id'], 'operatingsystem-id': new_os['id'] }) template = Template.info({'id': template['id']}) self.assertNotIn(os_string, template['operating-systems'])
def test_positive_remove_os_by_id(self): """Check if operating system can be removed from a template :id: b5362565-6dce-4770-81e1-4fe3ec6f6cee :expectedresults: Operating system is removed from template :CaseLevel: Integration :CaseImportance: Medium :BZ: 1395229 """ template = make_template() new_os = make_os() Template.add_operatingsystem({'id': template['id'], 'operatingsystem-id': new_os['id']}) template = Template.info({'id': template['id']}) os_string = '{} {}.{}'.format( new_os['name'], new_os['major-version'], new_os['minor-version'] ) self.assertIn(os_string, template['operating-systems']) Template.remove_operatingsystem({'id': template['id'], 'operatingsystem-id': new_os['id']}) template = Template.info({'id': template['id']}) self.assertNotIn(os_string, template['operating-systems'])
def test_positive_remove_os_by_id(self): """Check if operating system can be removed from a template @Feature: Template - Remove Operating System @Assert: Operating system is removed from template """ template = make_template() new_os = make_os() Template.add_operatingsystem({ 'id': template['id'], 'operatingsystem-id': new_os['id'], }) template = Template.info({'id': template['id']}) os_string = '{0} {1}.{2}'.format(new_os['name'], new_os['major-version'], new_os['minor-version']) self.assertIn(os_string, template['operating-systems']) Template.remove_operatingsystem({ 'id': template['id'], 'operatingsystem-id': new_os['id'] }) template = Template.info({'id': template['id']}) self.assertNotIn(os_string, template['operating-systems'])