From 1564e42ad397021093585147875a21dae1a3b3fc Mon Sep 17 00:00:00 2001 From: Carlton Gibson Date: Thu, 13 Jun 2019 16:39:00 +0200 Subject: [PATCH] Refs #30512, #15042 -- Added local-only address to sanitize_email() tests cases. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit email.headerregistry.parser.get_mailbox() returns a token with a `token_type` attribute. If `token_type` is `’invalid-mailbox’` then RFC violations have been detected. Emails with only the local part, and no domain, are correctly parsed but are marked as `’invalid-mailbox’`. As per #15042, local-only are supported, to enable sending to addresses on localhost. sanitize_email() does not currently check `token_type`. This test is added to avoid a regression in case this is revisited in the future. --- tests/mail/tests.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/mail/tests.py b/tests/mail/tests.py index aed4b89928..a36c09b369 100644 --- a/tests/mail/tests.py +++ b/tests/mail/tests.py @@ -716,6 +716,7 @@ class MailTests(HeadersCheckMixin, SimpleTestCase): 'utf-8', '=?utf-8?q?A_name?= ', ), + ('localpartonly', 'ascii', 'localpartonly'), # ASCII addresses with display names. ('A name ', 'ascii', 'A name '), ('A name ', 'utf-8', '=?utf-8?q?A_name?= '),