def test_method_convert_html_to_xml_empty_instance(self): """ Tests the convert_html_to_xml method in an empty instance """ tag_name = 'html-element' xccdf_html_element = HTMLElement(tag_name=tag_name) self.assertEqual(xccdf_html_element.convert_html_to_xml(), '', 'XML content from empty instance is not empty')
def test_method_get_html_content_empty_instance(self): """ Tests the get_html_content method in an empty instance """ tag_name = 'html-element' xccdf_html_element = HTMLElement(tag_name=tag_name) self.assertEqual(xccdf_html_element.get_html_content(), '', 'HTML content from empty instance is not empty')
def test_method_as_dict_empty(self): """ Tests the as_dict method from an empty object """ tag_name = 'html-element' xccdf_html_element = HTMLElement(tag_name=tag_name) element_dict = xccdf_html_element.as_dict() self.assertEqual(element_dict.get('name', None), xccdf_html_element.name, 'Name is not defined inside dictionary') self.assertIsNone(element_dict.get('content', None), 'Content is defined for an empty instance')
def test_method_update_xml_element_empty_instance(self): """ Tests the update_xml_element method from an empty instance """ tag_name = 'html-element' xccdf_html_element = HTMLElement(tag_name=tag_name) self.assertFalse(hasattr(xccdf_html_element, 'xml_element'), 'XML element is defined') xccdf_html_element.update_xml_element() self.assertTrue(hasattr(xccdf_html_element, 'xml_element'), 'XML element is not defined')