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))
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))
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))
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))
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))
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))
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))
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))
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))
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)
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')
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')
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')