def test_timeline_cursor(self): topic = PersonalizedStream.create_or_update_topic(self.network, '1', 'UN') cursor = TimelineCursor.init(self.network, topic.topic_id +":topicStream", 50, datetime.datetime.now()) data = PersonalizedStream.get_timeline_stream(cursor, True) self.assertTrue(data) PersonalizedStream.delete_topic(self.network, topic)
def previous_items(self): data = PersonalizedStream.get_timeline_stream(self, False) cursor = data["meta"]["cursor"] self.data.hasPrevious = cursor["hasPrev"] self.data.hasNext = cursor["prev"] is not None if self.data.hasNext: self.data.cursor_time = cursor["prev"] return data