diff options
author | Andrew Morgan <1342360+anoadragon453@users.noreply.github.com> | 2021-05-18 14:13:45 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-18 14:13:45 +0100 |
commit | 4d6e5a5e995590efe44855d10dcd2a89b841dae8 (patch) | |
tree | 793277f5bfeebe433857743707620660122aa3dd /tests/events | |
parent | Fix the allowed range of valid ordering characters for spaces. (#10002) (diff) | |
download | synapse-4d6e5a5e995590efe44855d10dcd2a89b841dae8.tar.xz |
Use a database table to hold the users that should have full presence sent to them, instead of something in-memory (#9823)
Diffstat (limited to 'tests/events')
-rw-r--r-- | tests/events/test_presence_router.py | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/tests/events/test_presence_router.py b/tests/events/test_presence_router.py index 01d257307c..875b0d0a11 100644 --- a/tests/events/test_presence_router.py +++ b/tests/events/test_presence_router.py @@ -302,11 +302,18 @@ class PresenceRouterTestCase(FederatingHomeserverTestCase): ) # Check that the expected presence updates were sent - expected_users = [ + # We explicitly compare using sets as we expect that calling + # module_api.send_local_online_presence_to will create a presence + # update that is a duplicate of the specified user's current presence. + # These are sent to clients and will be picked up below, thus we use a + # set to deduplicate. We're just interested that non-offline updates were + # sent out for each user ID. + expected_users = { self.other_user_id, self.presence_receiving_user_one_id, self.presence_receiving_user_two_id, - ] + } + found_users = set() calls = ( self.hs.get_federation_transport_client().send_transaction.call_args_list @@ -326,12 +333,12 @@ class PresenceRouterTestCase(FederatingHomeserverTestCase): # EDUs can contain multiple presence updates for presence_update in edu["content"]["push"]: # Check for presence updates that contain the user IDs we're after - expected_users.remove(presence_update["user_id"]) + found_users.add(presence_update["user_id"]) # Ensure that no offline states are being sent out self.assertNotEqual(presence_update["presence"], "offline") - self.assertEqual(len(expected_users), 0) + self.assertEqual(found_users, expected_users) def send_presence_update( |