summary refs log tree commit diff
path: root/tests/rest/media
diff options
context:
space:
mode:
authorRichard van der Hoff <richard@matrix.org>2020-11-13 23:11:43 +0000
committerRichard van der Hoff <richard@matrix.org>2020-11-15 23:09:03 +0000
commitcfd895a22e7563b6b22141d14d9c8aebf177df44 (patch)
tree0a2259d1f2d45646b946c7f060ae6dfc97edef8d /tests/rest/media
parentfix dict handling for make_request() (diff)
downloadsynapse-cfd895a22e7563b6b22141d14d9c8aebf177df44.tar.xz
use global make_request() directly where we have a custom Resource
Where we want to render a request against a specific Resource, call the global
make_request() function rather than the one in HomeserverTestCase, allowing us
to pass in an appropriate `Site`.
Diffstat (limited to 'tests/rest/media')
-rw-r--r--tests/rest/media/v1/test_media_storage.py17
1 files changed, 14 insertions, 3 deletions
diff --git a/tests/rest/media/v1/test_media_storage.py b/tests/rest/media/v1/test_media_storage.py
index 5f897d49cf..0fd31a0096 100644
--- a/tests/rest/media/v1/test_media_storage.py
+++ b/tests/rest/media/v1/test_media_storage.py
@@ -36,6 +36,7 @@ from synapse.rest.media.v1.media_storage import MediaStorage
 from synapse.rest.media.v1.storage_provider import FileStorageProviderBackend
 
 from tests import unittest
+from tests.server import FakeSite, make_request
 
 
 class MediaStorageTests(unittest.HomeserverTestCase):
@@ -227,7 +228,13 @@ class MediaRepoTests(unittest.HomeserverTestCase):
 
     def _req(self, content_disposition):
 
-        request, channel = self.make_request("GET", self.media_id, shorthand=False)
+        request, channel = make_request(
+            self.reactor,
+            FakeSite(self.download_resource),
+            "GET",
+            self.media_id,
+            shorthand=False,
+        )
         request.render(self.download_resource)
         self.pump()
 
@@ -317,8 +324,12 @@ class MediaRepoTests(unittest.HomeserverTestCase):
 
     def _test_thumbnail(self, method, expected_body, expected_found):
         params = "?width=32&height=32&method=" + method
-        request, channel = self.make_request(
-            "GET", self.media_id + params, shorthand=False
+        request, channel = make_request(
+            self.reactor,
+            FakeSite(self.thumbnail_resource),
+            "GET",
+            self.media_id + params,
+            shorthand=False,
         )
         request.render(self.thumbnail_resource)
         self.pump()