示例#1
0
    def testFindAllBySubscription(self):
        objs = Conversation.findAllBySubscription(1)
        self.assertTrue(is_array(objs))
        self.assertTrue(len(objs) > 0)

        for obj in objs:
            self.assertTrue(isinstance(obj, Conversation))
示例#2
0
    def testFindAllByUserName(self):
        objs = Conversation.findAllByUserName('john')
        self.assertTrue(is_array(objs))
        self.assertTrue(len(objs) > 0)

        for obj in objs:
            self.assertTrue(isinstance(obj, Conversation))
示例#3
0
    def testReplies(self):
        replies = Conversation.replies(6, 2)
        self.assertTrue(is_array(replies))
        self.assertTrue(len(replies) > 0)

        for reply in replies:
            self.assertTrue(isinstance(reply, Conversation))
示例#4
0
    def testFindAllAroundRadiusByUser(self):
        objs = Conversation.findAll(location=[-27.8727, -54.4951], radius=20000, user_id=2)
        self.assertTrue(is_array(objs))
        self.assertTrue(len(objs) > 0)

        for obj in objs:
            self.assertTrue(isinstance(obj, Conversation))
示例#5
0
    def testFindAllAround(self):
        objs = Conversation.findAll(location=[-27.8727, -54.4951])
        self.assertTrue(is_array(objs))
        self.assertTrue(len(objs) > 0)

        for obj in objs:
            self.assertTrue(isinstance(obj, Conversation))
示例#6
0
    def testFindAllPopularByUser(self):
        objs = Conversation.findAll(user_id=2, order_by='popular')
        self.assertTrue(is_array(objs))
        self.assertTrue(len(objs) > 0)

        for obj in objs:
            self.assertTrue(isinstance(obj, Conversation))
示例#7
0
    def testFindAllRecentByUser(self):
        objs = Conversation.findAll(user_id=2)
        self.assertTrue(is_array(objs))
        self.assertTrue(len(objs) > 0)

        for obj in objs:
            self.assertTrue(isinstance(obj, Conversation))
示例#8
0
    def testFindAllRecentByInterest(self):
        objs = Conversation.findAll(interest_id=6)
        self.assertTrue(is_array(objs))
        self.assertTrue(len(objs) > 0)

        for obj in objs:
            self.assertTrue(isinstance(obj, Conversation))
示例#9
0
    def testFindAllAfter(self):
        date = datetime.strptime("21/11/06 16:30", "%d/%m/%y %H:%M")
        objs = Conversation.findAll(after=date)
        self.assertTrue(is_array(objs))
        self.assertTrue(len(objs) > 0)

        for obj in objs:
            self.assertTrue(isinstance(obj, Conversation))
示例#10
0
    def testFindAllAroundByInterest(self):
        interest_id = 6
        objs = Conversation.findAll(interest_id=interest_id, location=[-27.8727, -54.4951])
        self.assertTrue(is_array(objs))
        self.assertTrue(len(objs) > 0)

        for obj in objs:
            self.assertTrue(isinstance(obj, Conversation))
            self.assertTrue(obj.interest.id == interest_id)
示例#11
0
    def testFindAllPopular(self):
        objs = Conversation.findAll(order_by='popular')
        self.assertTrue(is_array(objs))
        self.assertTrue(len(objs) > 0)

        for obj in objs:
            self.assertTrue(isinstance(obj, Conversation))

        if len(objs) > 2:
            self.assertTrue(objs[0].score >= objs[1].score, 'First object should have a greater score')
示例#12
0
    def testFindAllRecent(self):
        objs = Conversation.findAll()
        self.assertTrue(is_array(objs))
        self.assertTrue(len(objs) > 0)

        for obj in objs:
            self.assertTrue(isinstance(obj, Conversation))

        if len(objs) > 2:
            self.assertTrue(objs[0].created_at >= objs[1].created_at, 'First object should be newer')
示例#13
0
    def testFindAllAroundOrderByDistance(self):
        objs = Conversation.findAll(location=[-27.8727, -54.4951], order_by='distance')
        self.assertTrue(is_array(objs))
        self.assertTrue(len(objs) > 0)

        for obj in objs:
            self.assertTrue(isinstance(obj, Conversation))

        if len(objs) > 2:
            self.assertTrue(objs[0].distance <= objs[1].distance, 'First object should have a smaller distance')