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

Commit

Permalink
Refactor user directory tests (#10935)
Browse files Browse the repository at this point in the history
* Pull out GetUserDirectoryTables helper
* Don't rebuild the dir in tests that don't need it

In #10796 I changed registering a user to add directory entries under.
This means we don't have to force a directory regbuild in to tests of
the user directory search.

* Move test_initial to tests/storage
* Add type hints to both test_user_directory files

Co-authored-by: Richard van der Hoff <[email protected]>
  • Loading branch information
David Robertson and richvdh authored Sep 30, 2021
1 parent 428174f commit 3aefc7b
Show file tree
Hide file tree
Showing 6 changed files with 288 additions and 200 deletions.
1 change: 1 addition & 0 deletions changelog.d/10935.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Refactor user directory tests in preparation for upcoming changes.
6 changes: 6 additions & 0 deletions mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,12 @@ disallow_untyped_defs = True
[mypy-synapse.util.wheel_timer]
disallow_untyped_defs = True

[mypy-tests.handlers.test_user_directory]
disallow_untyped_defs = True

[mypy-tests.storage.test_user_directory]
disallow_untyped_defs = True

[mypy-pymacaroons.*]
ignore_missing_imports = True

Expand Down
2 changes: 1 addition & 1 deletion synapse/storage/databases/main/user_directory.py
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ async def get_user_in_directory(self, user_id: str) -> Optional[Dict[str, str]]:
desc="get_user_in_directory",
)

async def update_user_directory_stream_pos(self, stream_id: int) -> None:
async def update_user_directory_stream_pos(self, stream_id: Optional[int]) -> None:
await self.db_pool.simple_update_one(
table="user_directory_stream_pos",
keyvalues={},
Expand Down
Loading

0 comments on commit 3aefc7b

Please sign in to comment.