def test_cc(): email = EmailMessage('Subject', 'Content', '*****@*****.**', '*****@*****.**', cc='*****@*****.**') message = email.message() assert message['Cc'] == '*****@*****.**' assert email.get_recipients() == ['*****@*****.**', '*****@*****.**']
def test_multiple_bcc(): email = EmailMessage('Subject', 'Content', '*****@*****.**', bcc=['*****@*****.**', '*****@*****.**']) message = email.render() assert not message['To'] assert not message['Cc'] assert not message['Bcc'] # as it should assert email.get_recipients() == ['*****@*****.**', '*****@*****.**']
def test_cc(): email = EmailMessage('Subject', 'Content', '*****@*****.**', cc='*****@*****.**') message = email.render() assert message['Cc'] == '*****@*****.**' assert not message['To'] assert not message['Bcc'] assert email.get_recipients() == ['*****@*****.**']
def test_multiple_cc_and_to(): email = EmailMessage('Subject', 'Content', '*****@*****.**', to=['*****@*****.**', '*****@*****.**'], cc=['*****@*****.**', '*****@*****.**']) message = email.message() assert message['Cc'] == '[email protected], [email protected]' assert email.get_recipients() == ['*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**']
def test_multiple_cc(): email = EmailMessage('Subject', 'Content', '*****@*****.**', cc=['*****@*****.**', '*****@*****.**']) message = email.render() print(message['Cc']) assert message['Cc'] == '[email protected], [email protected]' assert not message['To'] assert not message['Bcc'] assert email.get_recipients() == ['*****@*****.**', '*****@*****.**']
def test_multiple_replyto(): email = EmailMessage('Subject', 'Content', '*****@*****.**', reply_to=['*****@*****.**', '*****@*****.**']) message = email.render() assert message['Reply-To'] == '[email protected], [email protected]' assert not message['To'] assert not message['Cc'] assert not message['Bcc'] # as it should assert email.get_recipients() == []
def test_recipients_as_tuple(): email = EmailMessage('Subject', 'Content', '*****@*****.**', to=('*****@*****.**', '*****@*****.**'), cc=('*****@*****.**', '*****@*****.**'), bcc=('*****@*****.**',)) message = email.message() assert message['Cc'] == '[email protected], [email protected]' assert email.get_recipients() == ['*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**']
def test_bcc(): email = EmailMessage('Subject', 'Content', '*****@*****.**', bcc='*****@*****.**') message = email.render() assert not message['To'] assert not message['Cc'] assert not message['Bcc'] # as it should assert email.get_recipients() == ['*****@*****.**']
def test_replyto(): email = EmailMessage('Subject', 'Content', '*****@*****.**', reply_to='*****@*****.**') message = email.render() assert message['Reply-To'] == '*****@*****.**' assert not message['To'] assert not message['Cc'] assert not message['Bcc'] # as it should assert email.get_recipients() == []
def test_multiple_to_cc_bcc(): email = EmailMessage('Subject', 'Content', '*****@*****.**', to=['*****@*****.**', '*****@*****.**'], cc=['*****@*****.**', '*****@*****.**'], bcc=['*****@*****.**', '*****@*****.**']) message = email.render() assert message['To'] == '[email protected], [email protected]' assert message['Cc'] == '[email protected], [email protected]' assert message['Bcc'] == '[email protected], [email protected]' assert email.get_recipients() == [ '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', ]
def test_recipients_as_tuple(): email = EmailMessage('Subject', 'Content', '*****@*****.**', to=('*****@*****.**', '*****@*****.**'), cc=('*****@*****.**', '*****@*****.**'), bcc=('*****@*****.**', )) message = email.render() assert message['To'] == '[email protected], [email protected]' assert message['Cc'] == '[email protected], [email protected]' assert not message['Bcc'] # as it should assert email.get_recipients() == [ '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', ]
def test_multiple_to_cc_bcc(): email = EmailMessage('Subject', 'Content', '*****@*****.**', to=['*****@*****.**', '*****@*****.**'], cc=['*****@*****.**', '*****@*****.**'], bcc=['*****@*****.**', '*****@*****.**']) message = email.render() assert message['To'] == '[email protected], [email protected]' assert message['Cc'] == '[email protected], [email protected]' assert not message['Bcc'] # as it should assert email.get_recipients() == [ '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', ]