From 9b9a7bddc49030496459f06e0b70a60bb6b89797 Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Fri, 30 Oct 2020 10:28:10 +0000 Subject: [PATCH] Fix mocked functions assert_called_with --- tests/api/test_auth.py | 6 +++++- tests/module_api/test_api.py | 11 ++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/tests/api/test_auth.py b/tests/api/test_auth.py index 0fd55f428a0d..ee5217b074db 100644 --- a/tests/api/test_auth.py +++ b/tests/api/test_auth.py @@ -282,7 +282,11 @@ def test_cannot_use_regular_token_as_guest(self): ) ) self.store.add_access_token_to_user.assert_called_with( - USER_ID, token, "DEVICE", None + user_id=USER_ID, + token=token, + device_id="DEVICE", + valid_until_ms=None, + puppets_user_id=None, ) def get_user(tok): diff --git a/tests/module_api/test_api.py b/tests/module_api/test_api.py index 9b573ac24dd9..27206ca3dbe5 100644 --- a/tests/module_api/test_api.py +++ b/tests/module_api/test_api.py @@ -94,12 +94,13 @@ def test_sending_events_into_room(self): self.assertFalse(hasattr(event, "state_key")) self.assertDictEqual(event.content, content) + expected_requester = create_requester( + user_id, authenticated_entity=self.hs.hostname + ) + # Check that the event was sent self.event_creation_handler.create_and_send_nonmember_event.assert_called_with( - create_requester(user_id), - event_dict, - ratelimit=False, - ignore_shadow_ban=True, + expected_requester, event_dict, ratelimit=False, ignore_shadow_ban=True, ) # Create and send a state event @@ -128,7 +129,7 @@ def test_sending_events_into_room(self): # Check that the event was sent self.event_creation_handler.create_and_send_nonmember_event.assert_called_with( - create_requester(user_id), + expected_requester, { "type": "m.room.power_levels", "content": content,