test_roomlist.py 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. # -*- coding: utf-8 -*-
  2. # Copyright 2018 New Vector Ltd
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License");
  5. # you may not use this file except in compliance with the License.
  6. # You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. from synapse.handlers.room_list import RoomListNextBatch
  16. import tests.unittest
  17. import tests.utils
  18. class RoomListTestCase(tests.unittest.TestCase):
  19. """ Tests RoomList's RoomListNextBatch. """
  20. def setUp(self):
  21. pass
  22. def test_check_read_batch_tokens(self):
  23. batch_token = RoomListNextBatch(
  24. stream_ordering="abcdef",
  25. public_room_stream_id="123",
  26. current_limit=20,
  27. direction_is_forward=True,
  28. ).to_token()
  29. next_batch = RoomListNextBatch.from_token(batch_token)
  30. self.assertEquals(next_batch.stream_ordering, "abcdef")
  31. self.assertEquals(next_batch.public_room_stream_id, "123")
  32. self.assertEquals(next_batch.current_limit, 20)
  33. self.assertEquals(next_batch.direction_is_forward, True)