mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-03 15:54:49 -04:00
Run Black on the tests again (#5170)
This commit is contained in:
parent
d9a02d1201
commit
b36c82576e
54 changed files with 818 additions and 1158 deletions
|
@ -36,9 +36,7 @@ from tests.unittest import HomeserverTestCase
|
|||
def check_logcontext(context):
|
||||
current = LoggingContext.current_context()
|
||||
if current is not context:
|
||||
raise AssertionError(
|
||||
"Expected logcontext %s but was %s" % (context, current),
|
||||
)
|
||||
raise AssertionError("Expected logcontext %s but was %s" % (context, current))
|
||||
|
||||
|
||||
class FederationClientTests(HomeserverTestCase):
|
||||
|
@ -54,6 +52,7 @@ class FederationClientTests(HomeserverTestCase):
|
|||
"""
|
||||
happy-path test of a GET request
|
||||
"""
|
||||
|
||||
@defer.inlineCallbacks
|
||||
def do_request():
|
||||
with LoggingContext("one") as context:
|
||||
|
@ -175,8 +174,7 @@ class FederationClientTests(HomeserverTestCase):
|
|||
|
||||
self.assertIsInstance(f.value, RequestSendFailed)
|
||||
self.assertIsInstance(
|
||||
f.value.inner_exception,
|
||||
(ConnectingCancelledError, TimeoutError),
|
||||
f.value.inner_exception, (ConnectingCancelledError, TimeoutError)
|
||||
)
|
||||
|
||||
def test_client_connect_no_response(self):
|
||||
|
@ -216,9 +214,7 @@ class FederationClientTests(HomeserverTestCase):
|
|||
Once the client gets the headers, _request returns successfully.
|
||||
"""
|
||||
request = MatrixFederationRequest(
|
||||
method="GET",
|
||||
destination="testserv:8008",
|
||||
path="foo/bar",
|
||||
method="GET", destination="testserv:8008", path="foo/bar"
|
||||
)
|
||||
d = self.cl._send_request(request, timeout=10000)
|
||||
|
||||
|
@ -258,8 +254,10 @@ class FederationClientTests(HomeserverTestCase):
|
|||
|
||||
# Send it the HTTP response
|
||||
client.dataReceived(
|
||||
(b"HTTP/1.1 200 OK\r\nContent-Type: application/json\r\n"
|
||||
b"Server: Fake\r\n\r\n")
|
||||
(
|
||||
b"HTTP/1.1 200 OK\r\nContent-Type: application/json\r\n"
|
||||
b"Server: Fake\r\n\r\n"
|
||||
)
|
||||
)
|
||||
|
||||
# Push by enough to time it out
|
||||
|
@ -274,9 +272,7 @@ class FederationClientTests(HomeserverTestCase):
|
|||
requiring a trailing slash. We need to retry the request with a
|
||||
trailing slash. Workaround for Synapse <= v0.99.3, explained in #3622.
|
||||
"""
|
||||
d = self.cl.get_json(
|
||||
"testserv:8008", "foo/bar", try_trailing_slash_on_400=True,
|
||||
)
|
||||
d = self.cl.get_json("testserv:8008", "foo/bar", try_trailing_slash_on_400=True)
|
||||
|
||||
# Send the request
|
||||
self.pump()
|
||||
|
@ -329,9 +325,7 @@ class FederationClientTests(HomeserverTestCase):
|
|||
|
||||
See test_client_requires_trailing_slashes() for context.
|
||||
"""
|
||||
d = self.cl.get_json(
|
||||
"testserv:8008", "foo/bar", try_trailing_slash_on_400=True,
|
||||
)
|
||||
d = self.cl.get_json("testserv:8008", "foo/bar", try_trailing_slash_on_400=True)
|
||||
|
||||
# Send the request
|
||||
self.pump()
|
||||
|
@ -368,10 +362,7 @@ class FederationClientTests(HomeserverTestCase):
|
|||
self.failureResultOf(d)
|
||||
|
||||
def test_client_sends_body(self):
|
||||
self.cl.post_json(
|
||||
"testserv:8008", "foo/bar", timeout=10000,
|
||||
data={"a": "b"}
|
||||
)
|
||||
self.cl.post_json("testserv:8008", "foo/bar", timeout=10000, data={"a": "b"})
|
||||
|
||||
self.pump()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue