diff --git a/0001-Add-a-deliverability-test-for-a-MX-fallback-A-record.patch b/0001-Add-a-deliverability-test-for-a-MX-fallback-A-record.patch new file mode 100644 index 0000000..8f38ff0 --- /dev/null +++ b/0001-Add-a-deliverability-test-for-a-MX-fallback-A-record.patch @@ -0,0 +1,82 @@ +From d6d3d15da96483e830c851a65059ae651c08b96d Mon Sep 17 00:00:00 2001 +From: Joshua Tauberer +Date: Sun, 14 Apr 2024 13:38:47 -0400 +Subject: [PATCH] Add a deliverability test for a MX-fallback A record + +--- + tests/mocked-dns-answers.json | 29 +++++++++++++++++++++++++++++ + tests/test_deliverability.py | 18 ++++++++++-------- + 2 files changed, 39 insertions(+), 8 deletions(-) + +diff --git a/tests/mocked-dns-answers.json b/tests/mocked-dns-answers.json +index 19e443c..ddc46b7 100644 +--- a/tests/mocked-dns-answers.json ++++ b/tests/mocked-dns-answers.json +@@ -13,6 +13,35 @@ + "5 gmail-smtp-in.l.google.com." + ] + }, ++ { ++ "query": { ++ "name": "pages.github.com", ++ "type": "MX", ++ "class": "IN" ++ }, ++ "answer": [] ++ }, ++ { ++ "query": { ++ "name": "pages.github.com", ++ "type": "A", ++ "class": "IN" ++ }, ++ "answer": [ ++ "185.199.108.153", ++ "185.199.109.153", ++ "185.199.110.153", ++ "185.199.111.153" ++ ] ++ }, ++ { ++ "query": { ++ "name": "pages.github.com", ++ "type": "TXT", ++ "class": "IN" ++ }, ++ "answer": [] ++ }, + { + "query": { + "name": "xkxufoekjvjfjeodlfmdfjcu.com", +diff --git a/tests/test_deliverability.py b/tests/test_deliverability.py +index 52124eb..7411c02 100644 +--- a/tests/test_deliverability.py ++++ b/tests/test_deliverability.py +@@ -10,14 +10,16 @@ from mocked_dns_response import MockedDnsResponseData, MockedDnsResponseDataClea + RESOLVER = MockedDnsResponseData.create_resolver() + + +-def test_deliverability_found(): +- response = validate_email_deliverability('gmail.com', 'gmail.com', dns_resolver=RESOLVER) +- assert response.keys() == {'mx', 'mx_fallback_type'} +- assert response['mx_fallback_type'] is None +- assert len(response['mx']) > 1 +- assert len(response['mx'][0]) == 2 +- assert isinstance(response['mx'][0][0], int) +- assert response['mx'][0][1].endswith('.com') ++@pytest.mark.parametrize( ++ 'domain,expected_response', ++ [ ++ ('gmail.com', {'mx': [(5, 'gmail-smtp-in.l.google.com'), (10, 'alt1.gmail-smtp-in.l.google.com'), (20, 'alt2.gmail-smtp-in.l.google.com'), (30, 'alt3.gmail-smtp-in.l.google.com'), (40, 'alt4.gmail-smtp-in.l.google.com')], 'mx_fallback_type': None}), ++ ('pages.github.com', {'mx': [(0, '185.199.108.153'), (0, '185.199.109.153'), (0, '185.199.111.153'), (0, '185.199.110.153')], 'mx_fallback_type': 'A'}), ++ ], ++) ++def test_deliverability_found(domain, expected_response): ++ response = validate_email_deliverability(domain, domain, dns_resolver=RESOLVER) ++ assert response == expected_response + + + def test_deliverability_fails(): +-- +2.33.0 + diff --git a/python-email-validator.spec b/python-email-validator.spec index c2eb07e..1164d62 100644 --- a/python-email-validator.spec +++ b/python-email-validator.spec @@ -1,11 +1,13 @@ %global _empty_manifest_terminate_build 0 Name: python-email-validator Version: 2.1.1 -Release: 2 +Release: 3 Summary: A robust email address syntax and deliverability validation library. License: Unlicense URL: https://github.com/JoshData/python-email-validator Source0: https://files.pythonhosted.org/packages/63/82/2914bff80ebee8c027802a664ad4b4caad502cd594e358f76aff395b5e56/email_validator-2.1.1.tar.gz +Patch0: 0001-Add-a-deliverability-test-for-a-MX-fallback-A-record.patch + BuildArch: noarch %description A robust email address syntax and deliverability validation library. @@ -29,7 +31,7 @@ A robust email address syntax and deliverability validation library. %prep -%autosetup -n email_validator-%{version} +%autosetup -n email_validator-%{version} -p1 %build %py3_build @@ -69,6 +71,9 @@ mv %{buildroot}/doclist.lst . %{_docdir}/* %changelog +* Thu May 09 2024 wangxiaomeng - 2.1.1-3 +- Backport one upstream patch:Add a deliverability test for a MX-fallback A record + * Tue May 07 2024 wangshuo - 2.1.1-2 - fix build error