<s> from __future__ import absolute_import <EOL> import mock <EOL> import os <EOL> import unittest <EOL> os . environ [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> from clay import config , mail <EOL> log = config . get_logger ( '<STR_LIT>' ) <EOL> class TestMail ( unittest . TestCase ) : <EOL> @ mock . patch ( "<STR_LIT>" ) <EOL> def test_sendmail ( self , mock_SMTP ) : <EOL> mock_SMTP_instance = mock_SMTP . return_value <EOL> mailto = '<STR_LIT>' <EOL> subject = '<STR_LIT>' <EOL> message = '<STR_LIT>' <EOL> mail . sendmail ( mailto , subject , message ) <EOL> args , kwargs = mock_SMTP_instance . sendmail . call_args <EOL> from_header = config . get ( '<STR_LIT>' ) <EOL> self . assertEqual ( from_header , args [ <NUM_LIT:0> ] ) <EOL> self . assertIn ( mailto , args [ <NUM_LIT:1> ] ) <EOL> self . assertIn ( '<STR_LIT>' % mailto , args [ <NUM_LIT:2> ] ) <EOL> self . assertIn ( '<STR_LIT>' % from_header , args [ <NUM_LIT:2> ] ) <EOL> self . assertIn ( '<STR_LIT>' % subject , args [ <NUM_LIT:2> ] ) <EOL> self . assertIn ( '<STR_LIT>' , args [ <NUM_LIT:2> ] ) <EOL> @ mock . patch ( "<STR_LIT>" ) <EOL> def test_sendmail_with_other_smtpconfig ( self , mock_SMTP ) : <EOL> mock_SMTP_instance = mock_SMTP . return_value <EOL> mailto = '<STR_LIT>' <EOL> subject = '<STR_LIT>' <EOL> message = '<STR_LIT>' <EOL> mail . sendmail ( <EOL> mailto , <EOL> subject , <EOL> message , <EOL> smtpconfig = config . get ( '<STR_LIT>' ) ) <EOL> args , kwargs = mock_SMTP_instance . sendmail . call_args <EOL> from_header = config . get ( '<STR_LIT>' ) <EOL> self . assertEqual ( from_header , args [ <NUM_LIT:0> ] ) <EOL> self . assertIn ( mailto , args [ <NUM_LIT:1> ] ) <EOL> self . assertIn ( '<STR_LIT>' % mailto , args [ <NUM_LIT:2> ] ) <EOL> self . assertIn ( '<STR_LIT>' % from_header , args [ <NUM_LIT:2> ] ) <EOL> self . assertIn ( '<STR_LIT>' % subject , args [ <NUM_LIT:2> ] ) <EOL> self . assertIn ( '<STR_LIT>' , args [ <NUM_LIT:2> ] ) </s>
