#NEWLINE# def test_mail_notifyonly( self ) : #NEWLINE# #INDENT# self . MockedSettings [ 'mail' ] [ 'notifyonly' ] = [ 'notifyme' , 'notifyyou' , 'notifyhim' , 'notifyher' ] #NEWLINE# with mock . patch . dict ( Settings , self . MockedSettings ) : #NEWLINE# #INDENT# recipient = 'test@test.com' #NEWLINE# message = 'test message' #NEWLINE# subject = 'test subject' #NEWLINE# from_email = 'fromtest@test.com' #NEWLINE# pushmanager . core . mail . MailQueue . _send_email ( recipient , message , subject , from_email ) #NEWLINE# T . assert_equal ( self . mocked_smtp . sendmail . called , True ) #NEWLINE# self . mocked_smtp . sendmail . assert_called_once_with ( from_email , self . MockedSettings [ 'mail' ] [ 'notifyonly' ] , mock . ANY ) #NEWLINE# args = self . mocked_smtp . sendmail . call_args_list [ 0 ] [ 0 ] #NEWLINE# body = ( 'Original recipients: %s\n\n%s' % ( recipient , message ) ) #NEWLINE# T . assert_equal ( args [ 2 ] . endswith ( body ) , True )