Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
tests: Rename build-email test, expand it for expected behavior.
Alex Vandiverbfd7254f17c6
diff --git a/zerver/tests/test_send_email.py b/zerver/tests/test_send_email.pyindex a32c3106368..31bbbee24cd 100644--- a/zerver/tests/test_send_email.py+++ b/zerver/tests/test_send_email.py@@ -17,8 +17,9 @@ from zerver.lib.test_classes import ZulipTestCaseclass TestBuildEmail(ZulipTestCase):- def test_build_SES_compatible_From_field_limit(self) -> None:+ def test_limited_from_length(self) -> None:hamlet = self.example_user("hamlet")+ # This is exactly the max lengthlimit_length_name = "a" * (320 - len(sanitize_address(FromAddress.NOREPLY, "utf-8")) - 3)mail = build_email("zerver/emails/password_reset",@@ -29,6 +30,16 @@ class TestBuildEmail(ZulipTestCase):)self.assertEqual(mail.extra_headers["From"], f"{limit_length_name} <{FromAddress.NOREPLY}>")+ # One more character makes it flip to just the address, with no name+ mail = build_email(+ "zerver/emails/password_reset",+ to_emails=[hamlet],+ from_name=limit_length_name + "a",+ from_address=FromAddress.NOREPLY,+ language="en",+ )+ self.assertEqual(mail.extra_headers["From"], FromAddress.NOREPLY)+def test_build_and_send_SES_incompatible_From_address(self) -> None:hamlet = self.example_user("hamlet")from_name = "Zulip"