Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Fix type hints for Monthly Active Users tests (#14889)
Browse files Browse the repository at this point in the history
  • Loading branch information
anoadragon453 authored Jan 22, 2023
1 parent 8d90e5f commit f075f6a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
1 change: 1 addition & 0 deletions changelog.d/14889.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add missing type hints.
1 change: 0 additions & 1 deletion mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ exclude = (?x)
|tests/rest/client/test_transactions.py
|tests/rest/media/v1/test_media_storage.py
|tests/server.py
|tests/server_notices/test_resource_limits_server_notices.py
|tests/test_state.py
|tests/test_terms_auth.py
)$
Expand Down
13 changes: 7 additions & 6 deletions tests/server_notices/test_resource_limits_server_notices.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def prepare(self, reactor: MemoryReactor, clock: Clock, hs: HomeServer) -> None:
self._rlsn._store.user_last_seen_monthly_active = Mock(
return_value=make_awaitable(1000)
)
self._rlsn._server_notices_manager.send_notice = Mock(
self._rlsn._server_notices_manager.send_notice = Mock( # type: ignore[assignment]
return_value=make_awaitable(Mock())
)
self._send_notice = self._rlsn._server_notices_manager.send_notice
Expand All @@ -82,8 +82,8 @@ def prepare(self, reactor: MemoryReactor, clock: Clock, hs: HomeServer) -> None:
self._rlsn._server_notices_manager.maybe_get_notice_room_for_user = Mock(
return_value=make_awaitable("!something:localhost")
)
self._rlsn._store.add_tag_to_room = Mock(return_value=make_awaitable(None))
self._rlsn._store.get_tags_for_room = Mock(return_value=make_awaitable({}))
self._rlsn._store.add_tag_to_room = Mock(return_value=make_awaitable(None)) # type: ignore[assignment]
self._rlsn._store.get_tags_for_room = Mock(return_value=make_awaitable({})) # type: ignore[assignment]

@override_config({"hs_disabled": True})
def test_maybe_send_server_notice_disabled_hs(self):
Expand Down Expand Up @@ -361,9 +361,10 @@ def _trigger_notice_and_join(self) -> Tuple[str, str, str]:
tok: The access token of the user that joined the room.
room_id: The ID of the room that's been joined.
"""
user_id = None
tok = None
invites = []
# We need at least one user to process
self.assertGreater(self.hs.config.server.max_mau_value, 0)

invites = {}

# Register as many users as the MAU limit allows.
for i in range(self.hs.config.server.max_mau_value):
Expand Down

0 comments on commit f075f6a

Please sign in to comment.