Tests pass on Python 3.

This commit is contained in:
Itamar Turner-Trauring 2021-01-12 14:39:20 -05:00
parent 03fb936716
commit 7a3e9ab43e
2 changed files with 6 additions and 6 deletions

View File

@ -1,6 +1,6 @@
import time import time
from urllib import ( from urllib.parse import (
quote, quote,
) )
@ -77,7 +77,7 @@ class RenderSlashUri(unittest.TestCase):
) )
self.assertEqual( self.assertEqual(
response_body, response_body,
"Invalid capability", b"Invalid capability",
) )
@ -92,7 +92,7 @@ class RenderServiceRow(unittest.TestCase):
ann = {"anonymous-storage-FURL": "pb://w2hqnbaa25yw4qgcvghl5psa3srpfgw3@tcp:127.0.0.1:51309/vucto2z4fxment3vfxbqecblbf6zyp6x", ann = {"anonymous-storage-FURL": "pb://w2hqnbaa25yw4qgcvghl5psa3srpfgw3@tcp:127.0.0.1:51309/vucto2z4fxment3vfxbqecblbf6zyp6x",
"permutation-seed-base32": "w2hqnbaa25yw4qgcvghl5psa3srpfgw3", "permutation-seed-base32": "w2hqnbaa25yw4qgcvghl5psa3srpfgw3",
} }
srv = NativeStorageServer("server_id", ann, None, {}, EMPTY_CLIENT_CONFIG) srv = NativeStorageServer(b"server_id", ann, None, {}, EMPTY_CLIENT_CONFIG)
srv.get_connection_status = lambda: ConnectionStatus(False, "summary", {}, 0, 0) srv.get_connection_status = lambda: ConnectionStatus(False, "summary", {}, 0, 0)
class FakeClient(_Client): class FakeClient(_Client):
@ -103,7 +103,7 @@ class RenderServiceRow(unittest.TestCase):
tub_maker=None, tub_maker=None,
node_config=EMPTY_CLIENT_CONFIG, node_config=EMPTY_CLIENT_CONFIG,
) )
self.storage_broker.test_add_server("test-srv", srv) self.storage_broker.test_add_server(b"test-srv", srv)
root = RootElement(FakeClient(), time.time) root = RootElement(FakeClient(), time.time)
req = DummyRequest(b"") req = DummyRequest(b"")

View File

@ -2,7 +2,7 @@ from past.builtins import unicode
import os import os
import time import time
import urllib from urllib.parse import quote as urlquote
from hyperlink import DecodedURL, URL from hyperlink import DecodedURL, URL
from pkg_resources import resource_filename from pkg_resources import resource_filename
@ -83,7 +83,7 @@ class URIHandler(resource.Resource, object):
# it seems Nevow was creating absolute URLs including # it seems Nevow was creating absolute URLs including
# host/port whereas req.uri is absolute (but lacks host/port) # host/port whereas req.uri is absolute (but lacks host/port)
redir_uri = URL.from_text(req.prePathURL().decode('utf8')) redir_uri = URL.from_text(req.prePathURL().decode('utf8'))
redir_uri = redir_uri.child(urllib.quote(uri_arg).decode('utf8')) redir_uri = redir_uri.child(urlquote(uri_arg))
# add back all the query args that AREN'T "?uri=" # add back all the query args that AREN'T "?uri="
for k, values in req.args.items(): for k, values in req.args.items():
if k != b"uri": if k != b"uri":