def generate_message(self): """ Populate factory-generated data with custom fields """ contacts = { 'first_name': 'test', 'last_name': 'user', 'email': '*****@*****.**', 'phone': '1234567890', } self.data = MessageFactory.attributes(create=False) self.data.update(contacts)
def setUp(self): self.contacts = {"first_name": "test", "last_name": "user", "email": "*****@*****.**", "phone": "1234567890"} loc_data = { # 'coordinates': FuzzyGeometryCollection().fuzz(), "coordinates": FuzzyPoint().fuzz(), "address": "test address", } self.data = MessageFactory.attributes(create=False) self.data.update(self.contacts) self.data.update(loc_data)
class TestMessage(TestCase): """ Test core message functionality. """ def setUp(self): self.user = UserFactory() self.region = RegionFactory() self.message = MessageFactory( user=self.user) def test_message_unicode(self): """ Test for message __unicode__ method. """ self.assertEqual(self.message.title, "%s" % self.message) def test_message_flags(self): """ Testing message default flags. """ self.assertFalse(self.message.is_active) self.assertFalse(self.message.is_important) self.assertTrue(self.message.is_anonymous) self.assertFalse(self.message.is_removed) self.assertTrue(self.message.allow_feedback) def test_message_save(self): """ Test for double save messages. """ self.message.save() self.assertEqual(1, len(Message.objects.all())) # self.assertIsNotNone(self.message.pk) # self.message.delete() def test_message_status(self): """ Test for default message status. """ self.assertEquals(self.message.status, Message.NEW) def test_additional_info(self): self.message.additional_info = {'test': 'one', } self.message.save() msg = Message.objects.get(pk=self.message.pk) self.assertEqual(self.message.additional_info, msg.additional_info)
class TestMessage(TestCase): """ Test core message functionality. """ def setUp(self): self.user = UserFactory() self.region = RegionFactory() self.message = MessageFactory(user=self.user) def test_message_unicode(self): """ Test for message __unicode__ method. """ self.assertEqual(self.message.title, "%s" % self.message) def test_message_flags(self): """ Testing message default flags. """ self.assertFalse(self.message.is_active) self.assertFalse(self.message.is_important) self.assertTrue(self.message.is_anonymous) self.assertFalse(self.message.is_removed) self.assertTrue(self.message.allow_feedback) def test_message_save(self): """ Test for double save messages. """ self.message.save() self.assertEqual(1, len(Message.objects.all())) # self.assertIsNotNone(self.message.pk) # self.message.delete() def test_message_status(self): """ Test for default message status. """ self.assertEquals(self.message.status, Message.NEW) def test_additional_info(self): self.message.additional_info = { 'test': 'one', } self.message.save() msg = Message.objects.get(pk=self.message.pk) self.assertEqual(self.message.additional_info, msg.additional_info)
def setUp(self): self.contacts = { 'first_name': 'test', 'last_name': 'user', 'email': '*****@*****.**', 'phone': '1234567890', } loc_data = { # 'coordinates': FuzzyGeometryCollection().fuzz(), 'coordinates': FuzzyPoint().fuzz(), 'address': 'test address', } self.data = MessageFactory.attributes(create=False) self.data.update(self.contacts) self.data.update(loc_data)
def setUp(self): self.user = UserFactory() self.data = MessageFactory.attributes(create=False, extra={"user": self.user})
def setUp(self): self.message = MessageFactory() self.category = CategoryFactory()
def setUp(self): self.virtual_message = MessageFactory(is_virtual=True) self.regular_message = MessageFactory(is_virtual=False)
def setUp(self): self.user = UserFactory() self.region = RegionFactory() self.message = MessageFactory(user=self.user)
def setUp(self): self.user = UserFactory() self.region = RegionFactory() self.message = MessageFactory( user=self.user)
def setUp(self): self.user = UserFactory() for x in xrange(50): MessageFactory(status=2, user=self.user) self.page = self.app.get(reverse('messages-list'))
def setUp(self): self.user = UserFactory() self.data = MessageFactory.attributes(create=False, extra={ 'user': self.user, })
def setUp(self): for x in range(50): MessageFactory(status=Message.VERIFIED)