예제 #1
0
 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)
예제 #2
0
 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)
예제 #3
0
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)
예제 #4
0
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)
예제 #5
0
 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)
예제 #6
0
 def setUp(self):
     self.user = UserFactory()
     self.data = MessageFactory.attributes(create=False, extra={"user": self.user})
예제 #7
0
 def setUp(self):
     self.message = MessageFactory()
     self.category = CategoryFactory()
예제 #8
0
 def setUp(self):
     self.virtual_message = MessageFactory(is_virtual=True)
     self.regular_message = MessageFactory(is_virtual=False)
예제 #9
0
 def setUp(self):
     self.user = UserFactory()
     self.region = RegionFactory()
     self.message = MessageFactory(user=self.user)
예제 #10
0
 def setUp(self):
     self.user = UserFactory()
     self.region = RegionFactory()
     self.message = MessageFactory(
         user=self.user)
예제 #11
0
 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'))
예제 #12
0
 def setUp(self):
     self.user = UserFactory()
     self.data = MessageFactory.attributes(create=False,
                                           extra={
                                               'user': self.user,
                                           })
예제 #13
0
 def setUp(self):
     for x in range(50):
         MessageFactory(status=Message.VERIFIED)