|
14 | 14 | ClickTracking, Content, |
15 | 15 | DynamicTemplateData, Email, From, |
16 | 16 | Mail, Personalization, |
17 | | - Subject, Substitution, To, TrackingSettings |
| 17 | + Subject, Substitution, To, Cc, Bcc, TrackingSettings |
18 | 18 | ) |
19 | 19 |
|
20 | 20 |
|
@@ -310,68 +310,74 @@ def test_error_is_not_raised_on_to_emails_set_to_list_of_tuples(self): |
310 | 310 | ('test+to1@example.com', 'Example To Name 1') |
311 | 311 | ] |
312 | 312 |
|
313 | | - try: |
314 | | - Mail( |
315 | | - from_email=From('test+from@example.com', 'Example From Name'), |
316 | | - to_emails=to_emails, |
317 | | - subject=Subject('Sending with SendGrid is Fun'), |
318 | | - plain_text_content=PlainTextContent( |
319 | | - 'and easy to do anywhere, even with Python'), |
320 | | - html_content=HtmlContent( |
321 | | - '<strong>and easy to do anywhere, even with Python</strong>')) |
322 | | - except: |
323 | | - self.fail('Mail() raised an error on list of tuples') |
| 313 | + Mail( |
| 314 | + from_email=From('test+from@example.com', 'Example From Name'), |
| 315 | + to_emails=to_emails, |
| 316 | + subject=Subject('Sending with SendGrid is Fun'), |
| 317 | + plain_text_content=PlainTextContent( |
| 318 | + 'and easy to do anywhere, even with Python'), |
| 319 | + html_content=HtmlContent( |
| 320 | + '<strong>and easy to do anywhere, even with Python</strong>')) |
324 | 321 |
|
325 | 322 | def test_error_is_not_raised_on_to_emails_set_to_list_of_strs(self): |
326 | 323 | from sendgrid.helpers.mail import (PlainTextContent, HtmlContent) |
327 | 324 | self.maxDiff = None |
328 | 325 | to_emails = ['test+to0@example.com', 'test+to1@example.com'] |
329 | 326 |
|
330 | | - try: |
331 | | - Mail( |
332 | | - from_email=From('test+from@example.com', 'Example From Name'), |
333 | | - to_emails=to_emails, |
334 | | - subject=Subject('Sending with SendGrid is Fun'), |
335 | | - plain_text_content=PlainTextContent( |
336 | | - 'and easy to do anywhere, even with Python'), |
337 | | - html_content=HtmlContent( |
338 | | - '<strong>and easy to do anywhere, even with Python</strong>')) |
339 | | - except: |
340 | | - self.fail('Mail() raised an error on list of strings') |
| 327 | + Mail( |
| 328 | + from_email=From('test+from@example.com', 'Example From Name'), |
| 329 | + to_emails=to_emails, |
| 330 | + subject=Subject('Sending with SendGrid is Fun'), |
| 331 | + plain_text_content=PlainTextContent( |
| 332 | + 'and easy to do anywhere, even with Python'), |
| 333 | + html_content=HtmlContent( |
| 334 | + '<strong>and easy to do anywhere, even with Python</strong>')) |
341 | 335 |
|
342 | 336 | def test_error_is_not_raised_on_to_emails_set_to_a_str(self): |
343 | 337 | from sendgrid.helpers.mail import (PlainTextContent, HtmlContent) |
344 | 338 | self.maxDiff = None |
345 | 339 | to_emails = 'test+to0@example.com' |
346 | 340 |
|
347 | | - try: |
348 | | - Mail( |
349 | | - from_email=From('test+from@example.com', 'Example From Name'), |
350 | | - to_emails=to_emails, |
351 | | - subject=Subject('Sending with SendGrid is Fun'), |
352 | | - plain_text_content=PlainTextContent( |
353 | | - 'and easy to do anywhere, even with Python'), |
354 | | - html_content=HtmlContent( |
355 | | - '<strong>and easy to do anywhere, even with Python</strong>')) |
356 | | - except: |
357 | | - self.fail('Mail() raised an error on a string') |
| 341 | + Mail( |
| 342 | + from_email=From('test+from@example.com', 'Example From Name'), |
| 343 | + to_emails=to_emails, |
| 344 | + subject=Subject('Sending with SendGrid is Fun'), |
| 345 | + plain_text_content=PlainTextContent( |
| 346 | + 'and easy to do anywhere, even with Python'), |
| 347 | + html_content=HtmlContent( |
| 348 | + '<strong>and easy to do anywhere, even with Python</strong>')) |
358 | 349 |
|
359 | 350 | def test_error_is_not_raised_on_to_emails_set_to_a_tuple(self): |
360 | 351 | from sendgrid.helpers.mail import (PlainTextContent, HtmlContent) |
361 | 352 | self.maxDiff = None |
362 | 353 | to_emails = ('test+to0@example.com', 'Example To Name 0') |
363 | 354 |
|
364 | | - try: |
365 | | - Mail( |
366 | | - from_email=From('test+from@example.com', 'Example From Name'), |
367 | | - to_emails=to_emails, |
368 | | - subject=Subject('Sending with SendGrid is Fun'), |
369 | | - plain_text_content=PlainTextContent( |
370 | | - 'and easy to do anywhere, even with Python'), |
371 | | - html_content=HtmlContent( |
372 | | - '<strong>and easy to do anywhere, even with Python</strong>')) |
373 | | - except: |
374 | | - self.fail('Mail() raised an error on a tuple of strings') |
| 355 | + Mail( |
| 356 | + from_email=From('test+from@example.com', 'Example From Name'), |
| 357 | + to_emails=to_emails, |
| 358 | + subject=Subject('Sending with SendGrid is Fun'), |
| 359 | + plain_text_content=PlainTextContent( |
| 360 | + 'and easy to do anywhere, even with Python'), |
| 361 | + html_content=HtmlContent( |
| 362 | + '<strong>and easy to do anywhere, even with Python</strong>')) |
| 363 | + |
| 364 | + def test_error_is_not_raised_on_to_emails_includes_bcc_cc(self): |
| 365 | + from sendgrid.helpers.mail import (PlainTextContent, HtmlContent) |
| 366 | + self.maxDiff = None |
| 367 | + to_emails = [ |
| 368 | + To('test+to0@example.com', 'Example To Name 0'), |
| 369 | + Bcc('test+bcc@example.com', 'Example Bcc Name 1'), |
| 370 | + Cc('test+cc@example.com', 'Example Cc Name 2') |
| 371 | + ] |
| 372 | + |
| 373 | + Mail( |
| 374 | + from_email=From('test+from@example.com', 'Example From Name'), |
| 375 | + to_emails=to_emails, |
| 376 | + subject=Subject('Sending with SendGrid is Fun'), |
| 377 | + plain_text_content=PlainTextContent( |
| 378 | + 'and easy to do anywhere, even with Python'), |
| 379 | + html_content=HtmlContent( |
| 380 | + '<strong>and easy to do anywhere, even with Python</strong>')) |
375 | 381 |
|
376 | 382 | def test_dynamic_template_data(self): |
377 | 383 | self.maxDiff = None |
|
0 commit comments