MCPcopy
hub / github.com/django/django / test_cc

Method test_cc

tests/mail/tests.py:309–363  ·  view source on GitHub ↗

Regression test for #7722

(self)

Source from the content-addressed store, hash-verified

307 )
308
309 def test_cc(self):
310 """Regression test for #7722"""
311 with self.subTest("Single Cc"):
312 email = EmailMessage(
313 "Subject",
314 "Content",
315 "from@example.com",
316 ["to@example.com"],
317 cc=["cc@example.com"],
318 )
319 message = email.message()
320 self.assertEqual(message["Cc"], "cc@example.com")
321 self.assertEqual(email.recipients(), ["to@example.com", "cc@example.com"])
322
323 with self.subTest("Multiple Cc with multiple To"):
324 email = EmailMessage(
325 "Subject",
326 "Content",
327 "from@example.com",
328 ["to@example.com", "other@example.com"],
329 cc=["cc@example.com", "cc.other@example.com"],
330 )
331 message = email.message()
332 self.assertEqual(message["Cc"], "cc@example.com, cc.other@example.com")
333 self.assertEqual(
334 email.recipients(),
335 [
336 "to@example.com",
337 "other@example.com",
338 "cc@example.com",
339 "cc.other@example.com",
340 ],
341 )
342
343 with self.subTest("Cc with Bcc"):
344 email = EmailMessage(
345 "Subject",
346 "Content",
347 "from@example.com",
348 ["to@example.com", "other@example.com"],
349 cc=["cc@example.com", "cc.other@example.com"],
350 bcc=["bcc@example.com"],
351 )
352 message = email.message()
353 self.assertEqual(message["Cc"], "cc@example.com, cc.other@example.com")
354 self.assertEqual(
355 email.recipients(),
356 [
357 "to@example.com",
358 "other@example.com",
359 "cc@example.com",
360 "cc.other@example.com",
361 "bcc@example.com",
362 ],
363 )
364
365 def test_cc_headers(self):
366 message = EmailMessage(

Callers

nothing calls this directly

Calls 3

messageMethod · 0.95
recipientsMethod · 0.95
EmailMessageClass · 0.90

Tested by

no test coverage detected