From 742fdd39fa3bd50910f7b090f4b06a3216c75596 Mon Sep 17 00:00:00 2001 From: mshivashankar Date: Mon, 16 Oct 2023 06:10:10 +0200 Subject: [PATCH] Fix Unit tests --- test/test_failsafe_mechanism.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/test/test_failsafe_mechanism.py b/test/test_failsafe_mechanism.py index 5f389dd3..ef722a62 100644 --- a/test/test_failsafe_mechanism.py +++ b/test/test_failsafe_mechanism.py @@ -47,40 +47,40 @@ def strip_html_tags(self, html_text): def test_render_html_template(self): # Test rendering of an HTML template - output, subject = self.Loop.run_until_complete(self.orchestrator._render_template("/Templates/Email/sample.html", {}, ["Tester@example.com"])) + output, subject = self.Loop.run_until_complete(self.orchestrator._render_template("/Templates/Email/sample.html", {})) self.assertEqual(output, "Mocked Jinja Output") def test_render_jinja_exception(self): # Test handling of Jinja2 exceptions self.MockJinjaService.format.side_effect = jinja2.exceptions.TemplateError("Mocked Jinja Error") - output, subject = self.Loop.run_until_complete(self.orchestrator._render_template("/Templates/Email/sample.html", {}, ["Tester@example.com"])) + output, subject = self.Loop.run_until_complete(self.orchestrator._render_template("/Templates/Email/sample.html", {})) self.assertIn("Error Details:", output) def test_render_md_template(self): # Test rendering of a Markdown template self.MockMarkdownToHtmlService.format.return_value = "Mocked Jinja Output" output, subject = self.Loop.run_until_complete( - self.orchestrator._render_template("/Templates/Email/sample.md", {}, ["Tester@example.com"])) + 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 def test_jinja_template_not_found(self): self.MockJinjaService.format.side_effect = jinja2.TemplateNotFound - error_message, _ = self.Loop.run_until_complete(self.orchestrator._render_template("/Templates/Email/sample.html", {}, ["Tester@example.com"])) + error_message, _ = self.Loop.run_until_complete(self.orchestrator._render_template("/Templates/Email/sample.html", {})) self.assertIn("Error Details:", error_message) def test_jinja_template_syntax_error(self): self.MockJinjaService.format.side_effect = jinja2.TemplateSyntaxError - error_message, _ = self.Loop.run_until_complete(self.orchestrator._render_template("/Templates/Email/sample.html", {}, ["Tester@example.com"])) + error_message, _ = self.Loop.run_until_complete(self.orchestrator._render_template("/Templates/Email/sample.html", {})) self.assertIn("Error Details:", error_message) def test_jinja_undefined_error(self): self.MockJinjaService.format.side_effect = jinja2.UndefinedError - error_message, _ = self.Loop.run_until_complete(self.orchestrator._render_template("/Templates/Email/sample.html", {}, ["Tester@example.com"])) + error_message, _ = self.Loop.run_until_complete(self.orchestrator._render_template("/Templates/Email/sample.html", {})) self.assertIn("Error Details:", error_message) def test_general_exception(self): self.MockJinjaService.format.side_effect = Exception("General Exception") - error_message, _ = self.Loop.run_until_complete(self.orchestrator._render_template("/Templates/Email/sample.html", {}, ["Tester@example.com"])) + error_message, _ = self.Loop.run_until_complete(self.orchestrator._render_template("/Templates/Email/sample.html", {})) self.assertIn("Error Details:", error_message)