Skip to content

⚙️ FEATURE-#20: Dedupe Email.from_email / EmailFactories.from_address#25

Merged
FernandoCelmer merged 1 commit into
developfrom
feature/20
Apr 16, 2026
Merged

⚙️ FEATURE-#20: Dedupe Email.from_email / EmailFactories.from_address#25
FernandoCelmer merged 1 commit into
developfrom
feature/20

Conversation

@FernandoCelmer
Copy link
Copy Markdown
Member

Closes #20

Summary

Email.from_email and EmailFactories.from_address were both calling resolve_imap_host and packing the result manually — two sources of truth for the same operation.

This PR keeps EmailFactories.from_address as the single implementation and reroutes Email.from_email through it.

Diff

@classmethod
def from_email(cls, address: str, password: str) -> Email:
    creds = EmailFactories.from_address(address, password)
    return cls(
        server=creds.server,
        user=creds.user,
        password=creds.password,
        port=creds.port,
        ssl=creds.ssl,
    )

Top-level import of resolve_imap_host in email.py is removed (no longer needed).

Test fix

tests/test_email.py::TestFromEmail::test_uses_resolver now patches email_profile.factories.resolve_imap_host (the real call site) instead of email_profile.email.resolve_imap_host.

Test plan

  • 165 tests pass
  • ruff + flake8 + format clean

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