Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
MadLittleMods committed Jun 17, 2024
1 parent 8965f3b commit c73391d
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions tests/handlers/test_sliding_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -1282,33 +1282,42 @@ def test_filter_encrypted_rooms(self) -> None:

after_rooms_token = self.event_sources.get_current_token()

# Get the rooms the user should be syncing with
sync_room_map = self.get_success(
self.sliding_sync_handler.get_sync_room_ids_for_user(
UserID.from_string(user1_id),
from_token=None,
to_token=after_rooms_token,
)
)

# Try with `is_encrypted=True`
truthy_filtered_room_ids = self.get_success(
truthy_filtered_room_map = self.get_success(
self.sliding_sync_handler.filter_rooms(
UserID.from_string(user1_id),
{room_id, encrypted_room_id},
sync_room_map,
SlidingSyncConfig.SlidingSyncList.Filters(
is_encrypted=True,
),
after_rooms_token,
)
)

self.assertEqual(truthy_filtered_room_ids, {encrypted_room_id})
self.assertEqual(truthy_filtered_room_map.keys(), {encrypted_room_id})

# Try with `is_encrypted=False`
falsy_filtered_room_ids = self.get_success(
falsy_filtered_room_map = self.get_success(
self.sliding_sync_handler.filter_rooms(
UserID.from_string(user1_id),
{room_id, encrypted_room_id},
sync_room_map,
SlidingSyncConfig.SlidingSyncList.Filters(
is_encrypted=False,
),
after_rooms_token,
)
)

self.assertEqual(falsy_filtered_room_ids, {room_id})
self.assertEqual(falsy_filtered_room_map.keys(), {room_id})


class SortRoomsTestCase(HomeserverTestCase):
Expand Down

0 comments on commit c73391d

Please sign in to comment.