Skip to content

Commit

Permalink
fix unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
mshivashankar committed Apr 25, 2024
1 parent d5493a0 commit d53555a
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions test/test_failsafe_mechanism.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,12 @@ def _mock_get_service(self, service_name):
return mock.Mock()

def strip_html_tags(self, html_text):
"""Remove HTML tags from the provided text."""
"""Remove HTML tags and extra whitespace from the provided text."""
clean = re.compile('<.*?>')
return re.sub(clean, '', html_text)
no_tags = re.sub(clean, '', html_text)
no_whitespace = re.sub(r'\s+', ' ', no_tags).strip()
return no_whitespace


def test_render_html_template(self):
# Test rendering of an HTML template
Expand All @@ -59,7 +62,7 @@ def test_render_md_template(self):
self.MockMarkdownToHtmlService.format.return_value = "Mocked Jinja Output"
output, subject = self.Loop.run_until_complete(
self.orchestrator._render_template("/Templates/Email/sample.md", {}))
self.assertEqual(self.strip_html_tags(output), "Mocked Jinja Output") # Removed the "\n" from the expected value
self.assertEqual(self.strip_html_tags(output), "Document Mocked Jinja Output") # Removed the "\n" from the expected value


if __name__ == "__main__":
Expand Down

0 comments on commit d53555a

Please sign in to comment.