From 3b3ea5409c7c31b5158c2ec5093d7021a927d2d3 Mon Sep 17 00:00:00 2001 From: Itamar Turner-Trauring Date: Mon, 3 Apr 2023 11:26:08 -0400 Subject: [PATCH] Type says we should only pass in DecodedURL. --- src/allmydata/test/test_storage_http.py | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/allmydata/test/test_storage_http.py b/src/allmydata/test/test_storage_http.py index 19529cd0e..ea93ad360 100644 --- a/src/allmydata/test/test_storage_http.py +++ b/src/allmydata/test/test_storage_http.py @@ -54,7 +54,7 @@ from ..storage.http_server import ( ClientSecretsException, _authorized_route, StorageIndexConverter, - _add_error_handling + _add_error_handling, ) from ..storage.http_client import ( StorageClient, @@ -348,7 +348,7 @@ class CustomHTTPServerTests(SyncTestCase): response = result_of( self.client.request( "GET", - "http://127.0.0.1/upload_secret", + DecodedURL.from_text("http://127.0.0.1/upload_secret"), ) ) self.assertEqual(response.code, 400) @@ -356,7 +356,9 @@ class CustomHTTPServerTests(SyncTestCase): # With secret, we're good. response = result_of( self.client.request( - "GET", "http://127.0.0.1/upload_secret", upload_secret=b"MAGIC" + "GET", + DecodedURL.from_text("http://127.0.0.1/upload_secret"), + upload_secret=b"MAGIC", ) ) self.assertEqual(response.code, 200) @@ -380,7 +382,7 @@ class CustomHTTPServerTests(SyncTestCase): response = result_of( self.client.request( "GET", - f"http://127.0.0.1/bytes/{length}", + DecodedURL.from_text(f"http://127.0.0.1/bytes/{length}"), ) ) @@ -401,7 +403,7 @@ class CustomHTTPServerTests(SyncTestCase): response = result_of( self.client.request( "GET", - f"http://127.0.0.1/bytes/{length}", + DecodedURL.from_text(f"http://127.0.0.1/bytes/{length}"), ) ) @@ -416,7 +418,7 @@ class CustomHTTPServerTests(SyncTestCase): response = result_of( self.client.request( "GET", - "http://127.0.0.1/slowly_never_finish_result", + DecodedURL.from_text("http://127.0.0.1/slowly_never_finish_result"), ) ) @@ -444,7 +446,7 @@ class CustomHTTPServerTests(SyncTestCase): response = result_of( self.client.request( "GET", - "http://127.0.0.1/die", + DecodedURL.from_text("http://127.0.0.1/die"), ) ) @@ -461,6 +463,7 @@ class Reactor(Clock): Advancing the clock also runs any callbacks scheduled via callFromThread. """ + def __init__(self): Clock.__init__(self) self._queue = Queue() @@ -501,7 +504,9 @@ class HttpTestFixture(Fixture): self.storage_server = StorageServer( self.tempdir.path, b"\x00" * 20, clock=self.clock ) - self.http_server = HTTPServer(self.clock, self.storage_server, SWISSNUM_FOR_TEST) + self.http_server = HTTPServer( + self.clock, self.storage_server, SWISSNUM_FOR_TEST + ) self.treq = StubTreq(self.http_server.get_resource()) self.client = StorageClient( DecodedURL.from_text("http://127.0.0.1"),