예제 #1
0
 def test_pystmark_call(self, mock_send, mock_apply_config):
     mock_apply_config.side_effect = self.unmocked_apply_config
     m = Message(text='hi')
     self.p._pystmark_call(mock_send, m)
     mock_apply_config.assert_called_once_with()
     mock_send.assert_called_with(m,
                                  api_key=self.api_key,
                                  test=False,
                                  secure=True)
예제 #2
0
 def test_pystmark_call_req_args(self, mock_send, mock_apply_config):
     mock_apply_config.side_effect = self.unmocked_apply_config
     m = Message(text='hi')
     self.p._pystmark_call(mock_send, m, **self.req_args)
     mock_apply_config.assert_called_once_with(**self.req_args)
     mock_send.assert_called_with(m,
                                  api_key=self.api_key,
                                  test=False,
                                  secure=True,
                                  headers=self.headers)
예제 #3
0
 def test_create(self, mock_init):
     Message()
     mock_init.assert_called_with(sender=None,
                                  reply_to=None,
                                  headers=None,
                                  verify=False,
                                  to=None,
                                  cc=None,
                                  bcc=None,
                                  subject=None,
                                  tag=None,
                                  html=None,
                                  text=None,
                                  attachments=None)
예제 #4
0
 def test_create_with_configuration(self, mock_init):
     self.app.config['PYSTMARK_DEFAULT_SENDER'] = '*****@*****.**'
     self.app.config['PYSTMARK_DEFAULT_REPLY_TO'] = '*****@*****.**'
     headers = [dict(Name='x', Value='y')]
     self.app.config['PYSTMARK_DEFAULT_HEADERS'] = headers
     self.app.config['PYSTMARK_VERIFY_MESSAGES'] = True
     Message()
     mock_init.assert_called_with(sender='*****@*****.**',
                                  reply_to='*****@*****.**',
                                  headers=headers,
                                  verify=True,
                                  to=None,
                                  cc=None,
                                  bcc=None,
                                  subject=None,
                                  tag=None,
                                  html=None,
                                  text=None,
                                  attachments=None)
예제 #5
0
 def test_send_batch_req_args(self, mock_call):
     msgs = [Message(text='thing'), Message(text='other')]
     self.p.send_batch(msgs, **self.req_args)
     mock_call.assert_called_with(pystmark.send_batch,
                                  msgs,
                                  headers=self.headers)
예제 #6
0
 def test_send_batch(self, mock_call):
     msgs = [Message(text='thing'), Message(text='other')]
     self.p.send_batch(msgs)
     mock_call.assert_called_with(pystmark.send_batch, msgs)
예제 #7
0
 def test_send_req_args(self, mock_call):
     m = Message()
     self.p.send(m, **self.req_args)
     mock_call.assert_called_with(pystmark.send, m, headers=self.headers)
예제 #8
0
 def test_send(self, mock_call):
     m = Message()
     self.p.send(m)
     mock_call.assert_called_with(pystmark.send, m)