Exemplo n.º 1
0
 def test_unknown_message(self):
     """Test a JSON message without a type returns an error"""
     message = loader('bounce')
     message['notificationType'] = 'Not A Valid Notification'
     result = views.process_message(message, self.notification)
     self.assertEqual(result.status_code, 200)
     self.assertEqual(
         result.content.decode('ascii'), 'Unknown Notification Type')
Exemplo n.º 2
0
 def test_missing_fields(self):
     """Test that missing vital fields returns an error"""
     message = loader('bounce')
     del(message['mail'])
     result = views.process_message(message, self.notification)
     self.assertEqual(result.status_code, 200)
     self.assertEqual(
         result.content.decode('ascii'), 'Missing Vital Fields')
Exemplo n.º 3
0
 def test_unknown_message(self):
     """Test a JSON message without a type returns an error"""
     message = loader('bounce')
     message['notificationType'] = 'Not A Valid Notification'
     result = views.process_message(message, self.notification)
     self.assertEqual(result.status_code, 200)
     self.assertEqual(result.content.decode('ascii'),
                      'Unknown Notification Type')
Exemplo n.º 4
0
 def test_missing_fields(self):
     """Test that missing vital fields returns an error"""
     message = loader('bounce')
     del (message['mail'])
     result = views.process_message(message, self.notification)
     self.assertEqual(result.status_code, 200)
     self.assertEqual(result.content.decode('ascii'),
                      'Missing Vital Fields')
Exemplo n.º 5
0
 def test_bounce(self, mock):
     """Test that a bounce is sent to process_bounce"""
     views.process_message(self.bounce, self.notification)
     mock.assert_called_with(self.bounce, self.notification)
Exemplo n.º 6
0
 def test_complaint(self, mock):
     """Test that a complaint is sent to process_complaint"""
     notification = loader('complaint_notification')
     views.process_message(self.complaint, notification)
     mock.assert_called_with(self.complaint, notification)
Exemplo n.º 7
0
 def test_bounce(self, mock):
     """Test that a bounce is sent to process_bounce"""
     views.process_message(self.bounce, self.notification)
     mock.assert_called_with(self.bounce, self.notification)
Exemplo n.º 8
0
 def test_complaint(self, mock):
     """Test that a complaint is sent to process_complaint"""
     notification = loader('complaint_notification')
     views.process_message(self.complaint, notification)
     mock.assert_called_with(self.complaint, notification)