def test_get_or_create_if_message_sid_with_exception(self, twilio_message):
     twilio_message.return_value = self.mock_message()
     message, created = Message.get_or_create('test')
     self.assertTrue(created)
     self.assertEqual(message, Message.objects.first())
     self.assertEqual(1, Message.objects.all().count())
 def test_get_or_create_if_not_message_sid_with_exception(self):
     message, created = Message.get_or_create(message=self.mock_message())
     self.assertTrue(created)
     self.assertEqual(message, Message.objects.first())
     self.assertEqual(1, Message.objects.all().count())
 def test_get_or_create_if_message_sid_no_exception(self):
     message_1 = message_recipe.make(sid='test')
     message_2, created = Message.get_or_create(message_sid='test')
     self.assertFalse(created)
     self.assertEqual(message_1, message_2)
     self.assertEqual(1, Message.objects.all().count())
Example #4
0
 def test_get_or_create_if_message_sid_with_exception(self, twilio_message):
     twilio_message.return_value = self.mock_message()
     message, created = Message.get_or_create('test')
     self.assertTrue(created)
     self.assertEqual(message, Message.objects.first())
     self.assertEqual(1, Message.objects.all().count())
Example #5
0
 def test_get_or_create_if_not_message_sid_with_exception(self):
     message, created = Message.get_or_create(message=self.mock_message())
     self.assertTrue(created)
     self.assertEqual(message, Message.objects.first())
     self.assertEqual(1, Message.objects.all().count())
Example #6
0
 def test_get_or_create_if_message_sid_no_exception(self):
     message_1 = message_recipe.make(sid='test')
     message_2, created = Message.get_or_create(message_sid='test')
     self.assertFalse(created)
     self.assertEqual(message_1, message_2)
     self.assertEqual(1, Message.objects.all().count())