Skip to content

Commit 0f0b4a4

Browse files
committed
Add a test for a domain without a MX record, with an A record, but with a reject-all SPF record
1 parent 4f69b42 commit 0f0b4a4

File tree

2 files changed

+31
-5
lines changed

2 files changed

+31
-5
lines changed

tests/mocked-dns-answers.json

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,32 +41,53 @@
4141
},
4242
{
4343
"query": {
44-
"name": "mail.example",
44+
"name": "nellis.af.mil",
4545
"type": "MX",
4646
"class": "IN"
4747
},
4848
"answer": []
4949
},
50+
{
51+
"query": {
52+
"name": "nellis.af.mil",
53+
"type": "A",
54+
"class": "IN"
55+
},
56+
"answer": [
57+
"132.58.234.0"
58+
]
59+
},
60+
{
61+
"query": {
62+
"name": "nellis.af.mil",
63+
"type": "TXT",
64+
"class": "IN"
65+
},
66+
"answer": [
67+
"\"v=spf1 -all\"",
68+
"\"MS=ms47108184\""
69+
]
70+
},
5071
{
5172
"query": {
5273
"name": "mail.example",
53-
"type": "ANY",
74+
"type": "MX",
5475
"class": "IN"
5576
},
5677
"answer": []
5778
},
5879
{
5980
"query": {
6081
"name": "mail.example",
61-
"type": "AAAA",
82+
"type": "ANY",
6283
"class": "IN"
6384
},
6485
"answer": []
6586
},
6687
{
6788
"query": {
68-
"name": "mail.example.com",
69-
"type": "MX",
89+
"name": "mail.example",
90+
"type": "AAAA",
7091
"class": "IN"
7192
},
7293
"answer": []

tests/test_deliverability.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ def test_deliverability_fails():
3131
with pytest.raises(EmailUndeliverableError, match='The domain name {} does not accept email'.format(domain)):
3232
validate_email_deliverability(domain, domain, dns_resolver=RESOLVER)
3333

34+
# No MX record, A record fallback, reject-all SPF record.
35+
domain = 'nellis.af.mil'
36+
with pytest.raises(EmailUndeliverableError, match='The domain name {} does not send email'.format(domain)):
37+
validate_email_deliverability(domain, domain, dns_resolver=RESOLVER)
38+
3439

3540
@pytest.mark.parametrize(
3641
'email_input',

0 commit comments

Comments
 (0)