MCPcopy
hub / github.com/django/django / test_connection_arg

Method test_connection_arg

tests/mail/tests.py:2228–2249  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2226
2227 # RemovedInDjango70Warning.
2228 def test_connection_arg(self):
2229 # Send using non-default connection.
2230 connection = custombackend.EmailBackend()
2231 with self.assertWarnsMessage(RemovedInDjango70Warning, CONNECTION_ARG_WARNING):
2232 send_mass_mail(
2233 [
2234 ("Subject1", "Content1", "from1@example.com", ["to1@example.com"]),
2235 ("Subject2", "Content2", "from2@example.com", ["to2@example.com"]),
2236 ],
2237 connection=connection,
2238 )
2239 self.assertEqual(mail.outbox, [])
2240 self.assertEqual(len(connection.test_outbox), 2)
2241 self.assertEqual(connection.test_outbox[0].subject, "Subject1")
2242 self.assertEqual(connection.test_outbox[1].subject, "Subject2")
2243 # Connection is provided to EmailMessage objects (#17811).
2244 with ignore_warnings(
2245 category=RemovedInDjango70Warning,
2246 message="The EmailMessage.connection attribute is deprecated.",
2247 ):
2248 self.assertIs(connection.test_outbox[0].connection, connection)
2249 self.assertIs(connection.test_outbox[1].connection, connection)
2250
2251 # RemovedInDjango70Warning.
2252 def test_auth_passed_to_backend_init(self):

Callers

nothing calls this directly

Calls 3

send_mass_mailFunction · 0.90
ignore_warningsClass · 0.90
assertWarnsMessageMethod · 0.80

Tested by

no test coverage detected