mirror of
https://github.com/element-hq/synapse.git
synced 2026-05-25 14:14:08 +00:00
mypy fix
This commit is contained in:
@@ -499,7 +499,9 @@ class AppServiceHandlerTestCase(unittest.TestCase):
|
||||
service.url = "mock_service_url"
|
||||
return service
|
||||
|
||||
def _mkservice_url_preview(self, is_in_namespace=True, is_exclusive=False) -> Mock:
|
||||
def _mkservice_url_preview(
|
||||
self, is_in_namespace: bool = True, is_exclusive: bool = False
|
||||
) -> Mock:
|
||||
"""
|
||||
Create a new mock representing an ApplicationService that is or is not interested
|
||||
in any preview urls.
|
||||
|
||||
@@ -130,7 +130,8 @@ class URLPreviewTests(unittest.HomeserverTestCase):
|
||||
"""
|
||||
Tests that previews fail if the appservice returns an empty response and is exclusive.
|
||||
"""
|
||||
query_preview_url = self.url_previewer.as_services.query_preview_url = (
|
||||
# We assign to a method, which mypy doesn't like.
|
||||
query_preview_url = self.url_previewer.as_services.query_preview_url = ( # type: ignore[method-assign]
|
||||
AsyncMock()
|
||||
)
|
||||
query_preview_url.return_value = ApplicationServiceUrlPreviewResult(
|
||||
@@ -147,7 +148,8 @@ class URLPreviewTests(unittest.HomeserverTestCase):
|
||||
"""
|
||||
Tests that previews succeed with an appservice provided result.
|
||||
"""
|
||||
query_preview_url = self.url_previewer.as_services.query_preview_url = (
|
||||
# We assign to a method, which mypy doesn't like.
|
||||
query_preview_url = self.url_previewer.as_services.query_preview_url = ( # type: ignore[method-assign]
|
||||
AsyncMock()
|
||||
)
|
||||
query_preview_url.return_value = ApplicationServiceUrlPreviewResult(
|
||||
@@ -166,9 +168,10 @@ class URLPreviewTests(unittest.HomeserverTestCase):
|
||||
"""
|
||||
Tests that previews fall through to the homeserver when the empty result is non-exclusive.
|
||||
"""
|
||||
do_preview_mock = self.url_previewer._do_preview = AsyncMock()
|
||||
# We assign to a method, which mypy doesn't like.
|
||||
do_preview_mock = self.url_previewer._do_preview = AsyncMock() # type: ignore[method-assign]
|
||||
do_preview_mock.return_value = b"HS provided bytes"
|
||||
query_preview_url = self.url_previewer.as_services.query_preview_url = (
|
||||
query_preview_url = self.url_previewer.as_services.query_preview_url = ( # type: ignore[method-assign]
|
||||
AsyncMock()
|
||||
)
|
||||
query_preview_url.return_value = ApplicationServiceUrlPreviewResult(
|
||||
|
||||
Reference in New Issue
Block a user