From b79b55395e5c780a83b648aeb7b1ea7af91421ee Mon Sep 17 00:00:00 2001 From: skushagra Date: Wed, 24 Jan 2024 11:31:48 +0530 Subject: [PATCH] Added tests for validataing email length of 254 characters --- tests/validators/tests.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/validators/tests.py b/tests/validators/tests.py index 5376517a4a..9e1187dc89 100644 --- a/tests/validators/tests.py +++ b/tests/validators/tests.py @@ -323,6 +323,9 @@ TEST_DATA = [ # Max length of domain name labels is 63 characters per RFC 1034. (validate_email, "a@%s.us" % ("a" * 63), None), (validate_email, "a@%s.us" % ("a" * 64), ValidationError), + # validation error if max length of email exceeds 254 chracters. + (validate_email, "%s@example.com" % ("a" * 50), None), + (validate_email, "%s@example.com" % ("a" * 250), ValidationError), # Trailing newlines in username or domain not allowed (validate_email, "a@b.com\n", ValidationError), (validate_email, "a\n@b.com", ValidationError),