mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2024-10-01 08:25:44 -04:00
Fix type hints in space summary tests. (#10575)
And ensure that the file is checked via mypy.
This commit is contained in:
parent
339c3918e1
commit
fab352ac2c
1
changelog.d/10575.feature
Normal file
1
changelog.d/10575.feature
Normal file
@ -0,0 +1 @@
|
|||||||
|
Add pagination to the spaces summary based on updates to [MSC2946](https://github.com/matrix-org/matrix-doc/pull/2946).
|
1
mypy.ini
1
mypy.ini
@ -86,6 +86,7 @@ files =
|
|||||||
tests/test_event_auth.py,
|
tests/test_event_auth.py,
|
||||||
tests/test_utils,
|
tests/test_utils,
|
||||||
tests/handlers/test_password_providers.py,
|
tests/handlers/test_password_providers.py,
|
||||||
|
tests/handlers/test_space_summary.py,
|
||||||
tests/rest/client/v1/test_login.py,
|
tests/rest/client/v1/test_login.py,
|
||||||
tests/rest/client/v2_alpha/test_auth.py,
|
tests/rest/client/v2_alpha/test_auth.py,
|
||||||
tests/util/test_itertools.py,
|
tests/util/test_itertools.py,
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
from typing import Any, Iterable, Optional, Tuple
|
from typing import Any, Iterable, List, Optional, Tuple
|
||||||
from unittest import mock
|
from unittest import mock
|
||||||
|
|
||||||
from synapse.api.constants import (
|
from synapse.api.constants import (
|
||||||
@ -127,7 +127,7 @@ class SpaceSummaryTestCase(unittest.HomeserverTestCase):
|
|||||||
self, space_id: str, room_id: str, token: str, order: Optional[str] = None
|
self, space_id: str, room_id: str, token: str, order: Optional[str] = None
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Add a child room to a space."""
|
"""Add a child room to a space."""
|
||||||
content = {"via": [self.hs.hostname]}
|
content: JsonDict = {"via": [self.hs.hostname]}
|
||||||
if order is not None:
|
if order is not None:
|
||||||
content["order"] = order
|
content["order"] = order
|
||||||
self.helper.send_state(
|
self.helper.send_state(
|
||||||
@ -439,9 +439,8 @@ class SpaceSummaryTestCase(unittest.HomeserverTestCase):
|
|||||||
)
|
)
|
||||||
# The result should have the space and all of the links, plus some of the
|
# The result should have the space and all of the links, plus some of the
|
||||||
# rooms and a pagination token.
|
# rooms and a pagination token.
|
||||||
expected = [(self.space, room_ids)] + [
|
expected: List[Tuple[str, Iterable[str]]] = [(self.space, room_ids)]
|
||||||
(room_id, ()) for room_id in room_ids[:6]
|
expected += [(room_id, ()) for room_id in room_ids[:6]]
|
||||||
]
|
|
||||||
self._assert_hierarchy(result, expected)
|
self._assert_hierarchy(result, expected)
|
||||||
self.assertIn("next_token", result)
|
self.assertIn("next_token", result)
|
||||||
|
|
||||||
@ -525,7 +524,7 @@ class SpaceSummaryTestCase(unittest.HomeserverTestCase):
|
|||||||
result = self.get_success(
|
result = self.get_success(
|
||||||
self.handler.get_room_hierarchy(self.user, self.space, max_depth=0)
|
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)
|
self._assert_hierarchy(result, expected)
|
||||||
|
|
||||||
# A single additional layer.
|
# A single additional layer.
|
||||||
|
@ -47,10 +47,10 @@ class RestHelper:
|
|||||||
|
|
||||||
def create_room_as(
|
def create_room_as(
|
||||||
self,
|
self,
|
||||||
room_creator: str = None,
|
room_creator: Optional[str] = None,
|
||||||
is_public: bool = True,
|
is_public: bool = True,
|
||||||
room_version: str = None,
|
room_version: Optional[str] = None,
|
||||||
tok: str = None,
|
tok: Optional[str] = None,
|
||||||
expect_code: int = 200,
|
expect_code: int = 200,
|
||||||
extra_content: Optional[Dict] = None,
|
extra_content: Optional[Dict] = None,
|
||||||
custom_headers: Optional[
|
custom_headers: Optional[
|
||||||
|
Loading…
Reference in New Issue
Block a user