summary refs log tree commit diff
path: root/tests/rest
diff options
context:
space:
mode:
authorRichard van der Hoff <1389908+richvdh@users.noreply.github.com>2020-11-16 15:22:40 +0000
committerGitHub <noreply@github.com>2020-11-16 15:22:40 +0000
commitbebfb9a97b4e6a5cc840dc6906e4aaebd5d7d30d (patch)
tree307ea9eba33d0301b39b79e0e0f9c2913b1418b0 /tests/rest
parentchangelog (diff)
parentRename `create_test_json_resource` to `create_test_resource` (#8759) (diff)
downloadsynapse-bebfb9a97b4e6a5cc840dc6906e4aaebd5d7d30d.tar.xz
Merge branch 'develop' into rav/pass_site_to_make_request
Diffstat (limited to 'tests/rest')
-rw-r--r--tests/rest/admin/test_admin.py2
-rw-r--r--tests/rest/client/v1/utils.py4
-rw-r--r--tests/rest/key/v2/test_remote_key_resource.py2
-rw-r--r--tests/rest/test_health.py6
-rw-r--r--tests/rest/test_well_known.py6
5 files changed, 7 insertions, 13 deletions
diff --git a/tests/rest/admin/test_admin.py b/tests/rest/admin/test_admin.py
index 64b6016729..9e4b0bca53 100644
--- a/tests/rest/admin/test_admin.py
+++ b/tests/rest/admin/test_admin.py
@@ -36,7 +36,7 @@ from tests.server import FakeSite, make_request
 class VersionTestCase(unittest.HomeserverTestCase):
     url = "/_synapse/admin/v1/server_version"
 
-    def create_test_json_resource(self):
+    def create_test_resource(self):
         resource = JsonResource(self.hs)
         VersionServlet(self.hs).register(resource)
         return resource
diff --git a/tests/rest/client/v1/utils.py b/tests/rest/client/v1/utils.py
index 60e4b9b846..900852f85b 100644
--- a/tests/rest/client/v1/utils.py
+++ b/tests/rest/client/v1/utils.py
@@ -317,9 +317,7 @@ class RestHelper:
             path,
             content=image_data,
             access_token=tok,
-        )
-        request.requestHeaders.addRawHeader(
-            b"Content-Length", str(image_length).encode("UTF-8")
+            custom_headers=[(b"Content-Length", str(image_length))],
         )
         request.render(resource)
         self.hs.get_reactor().pump([100])
diff --git a/tests/rest/key/v2/test_remote_key_resource.py b/tests/rest/key/v2/test_remote_key_resource.py
index 6850c666be..6671cbd32d 100644
--- a/tests/rest/key/v2/test_remote_key_resource.py
+++ b/tests/rest/key/v2/test_remote_key_resource.py
@@ -41,7 +41,7 @@ class BaseRemoteKeyResourceTestCase(unittest.HomeserverTestCase):
         self.http_client = Mock()
         return self.setup_test_homeserver(http_client=self.http_client)
 
-    def create_test_json_resource(self):
+    def create_test_resource(self):
         return create_resource_tree(
             {"/_matrix/key/v2": KeyApiV2Resource(self.hs)}, root_resource=NoResource()
         )
diff --git a/tests/rest/test_health.py b/tests/rest/test_health.py
index 2d021f6565..f4d06e2200 100644
--- a/tests/rest/test_health.py
+++ b/tests/rest/test_health.py
@@ -20,11 +20,9 @@ from tests import unittest
 
 
 class HealthCheckTests(unittest.HomeserverTestCase):
-    def setUp(self):
-        super().setUp()
-
+    def create_test_resource(self):
         # replace the JsonResource with a HealthResource.
-        self.resource = HealthResource()
+        return HealthResource()
 
     def test_health(self):
         request, channel = self.make_request("GET", "/health", shorthand=False)
diff --git a/tests/rest/test_well_known.py b/tests/rest/test_well_known.py
index dcd65c2a50..a3746e7130 100644
--- a/tests/rest/test_well_known.py
+++ b/tests/rest/test_well_known.py
@@ -20,11 +20,9 @@ from tests import unittest
 
 
 class WellKnownTests(unittest.HomeserverTestCase):
-    def setUp(self):
-        super().setUp()
-
+    def create_test_resource(self):
         # replace the JsonResource with a WellKnownResource
-        self.resource = WellKnownResource(self.hs)
+        return WellKnownResource(self.hs)
 
     def test_well_known(self):
         self.hs.config.public_baseurl = "https://tesths"