Skip to content

❤️ TEST-#37: Add coverage for resolve_smtp_host (known + DNS + fallback) - #81

Merged
FernandoCelmer merged 1 commit into
developfrom
feature/37
May 17, 2026
Merged

❤️ TEST-#37: Add coverage for resolve_smtp_host (known + DNS + fallback)#81
FernandoCelmer merged 1 commit into
developfrom
feature/37

Conversation

@FernandoCelmer

Copy link
Copy Markdown
Member

Summary

Expanded tests/test_providers_smtp.py from 6 cases to 26 covering every branch in SMTP host resolution:

  • All KNOWN_SMTP_PROVIDERS aliases (gmail/googlemail, office365 family, icloud family, yahoo/ymail, zoho, hostinger, fastmail, aol)
  • _split_email rejection paths: missing @, missing local part, missing domain
  • _lookup_smtp_srv: no-dns short-circuit, DNS exception, SRV→465 SSL, SRV→587 STARTTLS
  • _lookup_smtp_mx: no-dns short-circuit, DNS exception, hint match (aspmx.l.google.com → smtp.gmail.com), no-hint match returns None
  • Resolution order: known provider short-circuits DNS, SRV wins over MX for unknown domain
  • Convention fallback (smtp.<domain> on 465/SSL) when DNS unavailable
  • Module surface: SMTP_MX_HINTS populated, ProviderResolutionError subclass

Closes #37

Test plan

  • pytest tests/test_providers_smtp.py — 26 passed

@FernandoCelmer FernandoCelmer left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 Code Review

Code issues found: 0

Test-only PR. Coverage matrix for resolve_smtp_host is now exhaustive:

  • All KNOWN_SMTP_PROVIDERS aliases (gmail/googlemail/o365 family/icloud family/yahoo/ymail/zoho/hostinger/fastmail/aol)
  • _split_email rejection branches
  • _lookup_smtp_srv: no-DNS short-circuit, exception, SRV→465 (SSL), SRV→587 (STARTTLS)
  • _lookup_smtp_mx: hint match + no-hint-match + DNS exception
  • Resolution order asserts (known wins over DNS, SRV wins over MX)

_Target / _srv / _mx helpers mirror the dnspython shapes cleanly. No production code touched; risk is zero.

Closes #37.

@FernandoCelmer
FernandoCelmer merged commit 1ac7a22 into develop May 17, 2026
10 checks passed
@FernandoCelmer
FernandoCelmer deleted the feature/37 branch May 17, 2026 21:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant