Пример #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')
Пример #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')
Пример #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')
Пример #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')
Пример #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)
Пример #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)
Пример #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)
Пример #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)