summary refs log tree commit diff
path: root/tests/rest/client
diff options
context:
space:
mode:
authorRichard van der Hoff <github@rvanderhoff.org.uk>2016-01-28 09:49:46 +0000
committerRichard van der Hoff <github@rvanderhoff.org.uk>2016-01-28 09:49:46 +0000
commite26390ca46bfa876e9cc0eb7d32cb5f06a6a6bbb (patch)
tree1ec93e8b91fa63d002b6767d5c272ef12920f880 /tests/rest/client
parentRemove chdir (diff)
parentMake it possible to paginate forwards from stream tokens (diff)
downloadsynapse-e26390ca46bfa876e9cc0eb7d32cb5f06a6a6bbb.tar.xz
Merge pull request #535 from matrix-org/rav/paginate_from_stream_token
Make it possible to paginate forwards from stream tokens
Diffstat (limited to 'tests/rest/client')
-rw-r--r--tests/rest/client/v1/test_rooms.py16
1 files changed, 14 insertions, 2 deletions
diff --git a/tests/rest/client/v1/test_rooms.py b/tests/rest/client/v1/test_rooms.py
index cd03106e88..2fe6f695f5 100644
--- a/tests/rest/client/v1/test_rooms.py
+++ b/tests/rest/client/v1/test_rooms.py
@@ -1045,8 +1045,20 @@ class RoomMessageListTestCase(RestTestCase):
         self.assertTrue("end" in response)
 
     @defer.inlineCallbacks
-    def test_stream_token_is_rejected(self):
+    def test_stream_token_is_rejected_for_back_pagination(self):
         (code, response) = yield self.mock_resource.trigger_get(
-            "/rooms/%s/messages?access_token=x&from=s0_0_0_0" %
+            "/rooms/%s/messages?access_token=x&from=s0_0_0_0_0&dir=b" %
             self.room_id)
         self.assertEquals(400, code)
+
+    @defer.inlineCallbacks
+    def test_stream_token_is_accepted_for_fwd_pagianation(self):
+        token = "s0_0_0_0_0"
+        (code, response) = yield self.mock_resource.trigger_get(
+            "/rooms/%s/messages?access_token=x&from=%s" %
+            (self.room_id, token))
+        self.assertEquals(200, code)
+        self.assertTrue("start" in response)
+        self.assertEquals(token, response['start'])
+        self.assertTrue("chunk" in response)
+        self.assertTrue("end" in response)
\ No newline at end of file