예제 #1
0
 def _validate_mime_text_info(self, subject):
     self.assertEquals(
         [
             call('Subject', subject),
             call('From', '*****@*****.**'),
             call('To', '[email protected],[email protected]')
         ],
         notification_handler.MIMEText().__setitem__.call_args_list)
    def _validate_multipart_call(self):
        self._mock_open.assert_called_once_with('/home/test/wstore/media/bills/bill1.pdf', 'rb')

        notification_handler.MIMEBase.assert_called_once_with('application', 'pdf')
        notification_handler.MIMEBase().set_payload.assert_called_once_with(self._mock_open().read())

        notification_handler.encoders.encode_base64.assert_called_once_with(notification_handler.MIMEBase())
        notification_handler.MIMEBase().add_header.assert_called_once_with(
            'Content-Disposition',
            'attachment',
            filename='bill1.pdf'
        )

        self.assertEquals([
            call(notification_handler.MIMEText()),
            call(notification_handler.MIMEBase())
        ], notification_handler.MIMEMultipart().attach.call_args_list)