コード例 #1
0
    def testCreate(self):
        obj = User.create(User(name=self.name, email=self.name + '@teste.com', password='******'))
        self.assertEqual(obj.name, self.name)
        self.assertTrue(is_integer(obj.id), 'ID was supposed to be int. Value: %s' % str(obj.id))

        try:
            name = 'teste&%***(9 "" '
            obj = User.create(User(name=name, email=name + '@teste.com', password='******'))
            self.fail("Create user should not succeed with invalid data")
        except ValidationException, e:
            self.assertTrue(True)
コード例 #2
0
    def testCreate(self):
        name = 'teste_%s' % str(datetime.now())
        obj = Interest.create(Interest(name=name))
        self.assertEqual(obj.name, name)
        self.assertTrue(is_integer(obj.id), 'ID was supposed to be int. Value: %s' % str(obj.id))

        try:
            name = 't' * 255
            obj = Interest.create(Interest(name=name))
            self.fail("Create interest should not succeed with invalid data")
        except ValidationException, e:
            self.assertTrue(True)
コード例 #3
0
    def testCreate(self):
        # create without location data
        obj = Conversation.parse({
                'interest_id' : 1,
                'user_id'                       : 1,
                'message'                       : "Hello there, this is just a test, ok?"
        })
        obj = Conversation.create(obj)
        self.assertTrue(is_integer(obj.id))

        # create a reply to the conversation above
        obj2 = Conversation.parse({
                'interest_id'   : 1,
                'user_id'                       : 2,
                'message'                       : "And this is a reply.",
                'lat'                                   : -27.8738,
                'lon'                                   : -54.4761,
                'parent_id'             : obj.id
        })
        obj2 = Conversation.create(obj2)
        self.assertTrue(is_integer(obj2.id))
コード例 #4
0
    def testCreate(self):
        obj = User.create(
            User(name=self.name,
                 email=self.name + '@teste.com',
                 password='******'))
        self.assertEqual(obj.name, self.name)
        self.assertTrue(is_integer(obj.id),
                        'ID was supposed to be int. Value: %s' % str(obj.id))

        try:
            name = 'teste&%***(9 "" '
            obj = User.create(
                User(name=name, email=name + '@teste.com', password='******'))
            self.fail("Create user should not succeed with invalid data")
        except ValidationException, e:
            self.assertTrue(True)
コード例 #5
0
 def testCountAllByUser(self):
     count = Conversation.countAllByUser(1)
     self.assertTrue(is_integer(count))
コード例 #6
0
 def testCountAll(self):
     count = Conversation.countAll()
     self.assertTrue(is_integer(count))
     self.assertTrue(count > 0)
コード例 #7
0
 def testFind(self):
     obj = Interest.find(1)
     self.assertEqual(obj.name, 'Photography')
     self.assertTrue(is_integer(obj.id))
コード例 #8
0
 def testCountAllByUser(self):
     count = Conversation.countAll(user_id=2)
     self.assertTrue(is_integer(count))
     self.assertTrue(count > 0)
コード例 #9
0
 def testCountAllAfter(self):
     date = datetime.strptime("21/11/06 16:30", "%d/%m/%y %H:%M")
     count = Conversation.countAll(after=date)
     self.assertTrue(is_integer(count))
     self.assertTrue(count > 0)
コード例 #10
0
 def testCountAllBySubscription(self):
     count = Conversation.countAllBySubscription(1)
     self.assertTrue(is_integer(count))
コード例 #11
0
 def testCountAllByInterest(self):
     count = Conversation.countAll(interest_id=1)
     self.assertTrue(is_integer(count))
     self.assertTrue(count > 0)
コード例 #12
0
 def testCountAllByUserName(self):
     count = Interest.countAllByUserName('john')
     self.assertTrue(is_integer(count))
コード例 #13
0
 def testCountAllByUserName(self):
     count = Conversation.countAllByUserName('john')
     self.assertTrue(is_integer(count))
コード例 #14
0
 def testFindReply(self):
     obj = Conversation.findReply(6, 2, 7)
     self.assertTrue(isinstance(obj, Conversation))
     self.assertTrue(is_integer(obj.id))
コード例 #15
0
 def testFind(self):
     obj = Conversation.find(1, 1)
     self.assertTrue(isinstance(obj, Conversation))
     self.assertTrue(is_integer(obj.id))
コード例 #16
0
 def testFindByKey(self):
     app = Application.findByKey('9c7dc77314ca22b8eec94440fa528157f8b8be03')
     self.assertTrue(app is not None)
     self.assertTrue(is_integer(app.id))
コード例 #17
0
 def testCountAllAround(self):
     count = Interest.countAll(location=[-27.86403, -54.4593889], radius=20000)
     self.assertTrue(is_integer(count))
コード例 #18
0
 def testCountAll(self):
     count = Interest.countAll()
     self.assertTrue(is_integer(count))