150
150
self.assertMessages([2, 3], messages)
151
151
prev, messages, next = conn.get_messages(archive, 'date', 2, next)
152
152
self.assertMessages([4], messages)
154
def test_batching_forward_complete(self):
155
conn, archive = self.makeArchive()
156
self.makeMessages(conn, archive, 3)
157
prev, messages, next = conn.get_messages(archive, 'date', 3, '')
158
self.assertMessages([0, 1, 2], messages)
153
prev, messages, next = conn.get_messages(archive, 'date', 2, next)
154
self.assertIs(None, prev)
155
self.assertMessages([], messages)
159
156
self.assertIs(None, next)
158
def test_batching_backward(self):
159
conn, archive = self.makeArchive()
160
self.makeMessages(conn, archive, 5)
161
prev, messages, next = conn.get_messages(archive, 'date', 2, '')
162
self.assertMessages([0, 1], messages)
163
prev, messages, next = conn.get_messages(archive, 'date', 2, next)
164
self.assertMessages([2, 3], messages)
165
# XXX: We shouldn't have to reverse the sort order. There should
166
# be a flag to work backwards, but I'm not sure if we can get
167
# that from Cassandra without reversing in Python.
168
prev, messages, next = conn.get_messages(archive, '-date', 2, prev)
169
self.assertMessages([1, 0], messages)