Skip to content

[pull] main from django:main#403

Merged
pull[bot] merged 6 commits into
threatcode:mainfrom
django:main
May 7, 2026
Merged

[pull] main from django:main#403
pull[bot] merged 6 commits into
threatcode:mainfrom
django:main

Conversation

@pull
Copy link
Copy Markdown

@pull pull Bot commented May 7, 2026

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.4)

Can you help keep this open source service alive? 💖 Please sponsor : )

medmunds added 6 commits May 6, 2026 22:39
* Renamed shared backend test case class to SharedEmailBackendTests,
  to avoid confusion with tests for the BaseEmailBackend.

* Used consistent module references to mail functions (removed `mail.`
  from most uses; kept it for `mail.get_connection()`).

* Used consistent `backend` variable name for EmailBackend instances in
  backend tests (matching most SMTP tests, replacing `connection` and
  `conn` in other tests).

* Renamed some test cases for clarity.

* Removed some unnecessary docstrings from test cases.

* Reformatted some docstrings with nearby edits.
* Removed unnecessary empty username/password args and unnecessary test
  email content.

* Replaced monkeypatching with mock.patch. Minimized scope of patches.

* Added missing assertions in some tests.

* Cleaned up uses of assertTrue() and assertFalse().

* Removed implicit assumption in LocmemBackendTests that mail is always
  sent by the locmem backend during tests.

* Made FileBackendTests tmp_dir cleanup more robust, and added helpers
  to simplify test cases.

* Split FileBackendTests.test_sessions() into three distinct cases (and
  removed unrelated, duplicative verification of message content).

* Used mock to simplify and improve accuracy of SMTP AUTH test.

* Replaced `get_connection("mail.custombackend.EmailBackend")` with
  direct `custombackend.EmailBackend()` construction to avoid soon-to-
  be-deprecated usage of `get_connection(backend_path)` in cases that
  aren't trying to test creating a connection from an import path.
Added tests for:

* BaseEmailBackend class.

* EmailBackend support for fail_silently arg and unknown kwargs.

* File backend support for EMAIL_FILE_PATH setting.

* File backend configuration error reporting (where possible).

* SMTP backend support for EMAIL_HOST and EMAIL_PORT settings.

* SMTP backend use of ssl_certfile, ssl_keyfile, timeout options.

* send_mail() return value.

* send_mass_mail() basic behavior.

* send_mail() and send_mass_mail() support for auth_user, auth_password,
  and fail_silently args.

* get_connection() support for EMAIL_BACKEND setting and backend-specfic
  kwargs.
Replaced TypeError in `os.path.abspath(None)` with ImproperlyConfigured
error when settings.EMAIL_FILE_PATH is required but missing.
Added missing test to verify Django's test runner swaps in the locmem
EmailBackend during tests.

Extracted reusable mock_test_state() helper from
SetupTestEnvironmentTests.test_allowed_hosts().
Simplified and removed use of soon-to-be-deprecated or removed features
from tests for AdminEmailHandler and BrokenLinkEmailsMiddleware. Added
or updated cases to ensure `fail_silently` usage remains consistent
during the transition to email providers.

Changed custom FailingEmailBackend to respect fail_silently and record
its use in a class-level property.

In AdminEmailHandlerTest:

* Added make_log_record() helper to reduce duplicated code.

* Changed test_fail_silently() to send through the FailingEmailBackend,
  which will fail if not initialized with fail_silently=True. (Rather
  than inspecting attributes of a soon-to-be-deprecated connection.)

* Simplified test_uses_custom_email_backend() by replacing monkeypatches
  with inspectable custom backend.

* In test_customize_send_mail_method(), removed use of the undocumented
  self.connection() method and the soon-to-be-deprecated `connection`
  arg to mail_managers(). This test verifies a subclass can customize
  sending by mailing the managers rather than the admins. Involving a
  email backend connection was irrelevant.

In BrokenLinkEmailsMiddlewareTest, added a case with FailingEmailBackend
to verify send uses fail_silently=True.
@pull pull Bot locked and limited conversation to collaborators May 7, 2026
@pull pull Bot added the ⤵️ pull label May 7, 2026
@pull pull Bot merged commit 21dcd9a into threatcode:main May 7, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant