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

Fix types in spaces tests. #10575

Merged
merged 2 commits into from
Aug 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/10575.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add pagination to the spaces summary based on updates to [MSC2946](https://github.com/matrix-org/matrix-doc/pull/2946).
1 change: 1 addition & 0 deletions mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ files =
tests/test_event_auth.py,
tests/test_utils,
tests/handlers/test_password_providers.py,
tests/handlers/test_space_summary.py,
tests/rest/client/v1/test_login.py,
tests/rest/client/v2_alpha/test_auth.py,
tests/util/test_itertools.py,
Expand Down
11 changes: 5 additions & 6 deletions tests/handlers/test_space_summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from typing import Any, Iterable, Optional, Tuple
from typing import Any, Iterable, List, Optional, Tuple
from unittest import mock

from synapse.api.constants import (
Expand Down Expand Up @@ -127,7 +127,7 @@ def _add_child(
self, space_id: str, room_id: str, token: str, order: Optional[str] = None
) -> None:
"""Add a child room to a space."""
content = {"via": [self.hs.hostname]}
content: JsonDict = {"via": [self.hs.hostname]}
if order is not None:
content["order"] = order
self.helper.send_state(
Expand Down Expand Up @@ -439,9 +439,8 @@ def test_pagination(self):
)
# The result should have the space and all of the links, plus some of the
# rooms and a pagination token.
expected = [(self.space, room_ids)] + [
(room_id, ()) for room_id in room_ids[:6]
]
expected: List[Tuple[str, Iterable[str]]] = [(self.space, room_ids)]
expected += [(room_id, ()) for room_id in room_ids[:6]]
self._assert_hierarchy(result, expected)
self.assertIn("next_token", result)

Expand Down Expand Up @@ -525,7 +524,7 @@ def test_max_depth(self):
result = self.get_success(
self.handler.get_room_hierarchy(self.user, self.space, max_depth=0)
)
expected = [(spaces[0], [rooms[0], spaces[1]])]
expected: List[Tuple[str, Iterable[str]]] = [(spaces[0], [rooms[0], spaces[1]])]
self._assert_hierarchy(result, expected)

# A single additional layer.
Expand Down
6 changes: 3 additions & 3 deletions tests/rest/client/v1/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ class RestHelper:

def create_room_as(
self,
room_creator: str = None,
room_creator: Optional[str] = None,
is_public: bool = True,
room_version: str = None,
tok: str = None,
room_version: Optional[str] = None,
tok: Optional[str] = None,
expect_code: int = 200,
extra_content: Optional[Dict] = None,
custom_headers: Optional[
Expand Down