Remove some boilerplate in tests (#4156)

This commit is contained in:
Amber Brown 2018-11-07 03:00:00 +11:00 committed by GitHub
parent 0f5e51f726
commit e62f7f17b3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 163 additions and 217 deletions

View file

@ -189,11 +189,11 @@ class HomeserverTestCase(TestCase):
for servlet in self.servlets:
servlet(self.hs, self.resource)
from tests.rest.client.v1.utils import RestHelper
self.helper = RestHelper(self.hs, self.resource, getattr(self, "user_id", None))
if hasattr(self, "user_id"):
from tests.rest.client.v1.utils import RestHelper
self.helper = RestHelper(self.hs, self.resource, self.user_id)
if self.hijack_auth:
def get_user_by_access_token(token=None, allow_guest=False):
@ -285,7 +285,9 @@ class HomeserverTestCase(TestCase):
if isinstance(content, dict):
content = json.dumps(content).encode('utf8')
return make_request(method, path, content, access_token, request, shorthand)
return make_request(
self.reactor, method, path, content, access_token, request, shorthand
)
def render(self, request):
"""