mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-02-22 02:16:42 +00:00
Another test passing on Python 3.
This commit is contained in:
parent
58745fd373
commit
e271cd1b64
@ -268,9 +268,9 @@ class FakeClient(_Client): # type: ignore # tahoe-lafs/ticket/3573
|
||||
self.introducer_furls = []
|
||||
self.introducer_clients = []
|
||||
self.stats_provider = FakeStatsProvider()
|
||||
self._secret_holder = SecretHolder("lease secret", "convergence secret")
|
||||
self._secret_holder = SecretHolder(b"lease secret", b"convergence secret")
|
||||
self.helper = None
|
||||
self.convergence = "some random string"
|
||||
self.convergence = b"some random string"
|
||||
self.storage_broker = StorageFarmBroker(
|
||||
permute_peers=True,
|
||||
tub_maker=None,
|
||||
@ -1562,7 +1562,7 @@ class Web(WebMixin, WebErrorMixin, testutil.StallMixin, testutil.ReallyEqualMixi
|
||||
def _just_the_etag(result):
|
||||
data, response, headers = result
|
||||
etag = headers.getRawHeaders('etag')[0]
|
||||
if uri.startswith('URI:DIR'):
|
||||
if uri.startswith(b'URI:DIR'):
|
||||
self.failUnless(etag.startswith('DIR:'), etag)
|
||||
return etag
|
||||
return d.addCallback(_just_the_etag)
|
||||
@ -1570,7 +1570,7 @@ class Web(WebMixin, WebErrorMixin, testutil.StallMixin, testutil.ReallyEqualMixi
|
||||
# Check that etags work with immutable directories
|
||||
(newkids, caps) = self._create_immutable_children()
|
||||
d = self.POST2(self.public_url + "/foo/newdir?t=mkdir-immutable",
|
||||
json.dumps(newkids))
|
||||
json.dumps(newkids).encode("ascii"))
|
||||
def _stash_immdir_uri(uri):
|
||||
self._immdir_uri = uri
|
||||
return uri
|
||||
@ -1598,13 +1598,13 @@ class Web(WebMixin, WebErrorMixin, testutil.StallMixin, testutil.ReallyEqualMixi
|
||||
d.addCallback(_check_match)
|
||||
|
||||
def _no_etag(uri, t):
|
||||
target = "/uri/%s?t=%s" % (uri, t)
|
||||
target = "/uri/%s?t=%s" % (unicode(uri, "ascii"), t)
|
||||
d = self.GET(target, return_response=True, followRedirect=True)
|
||||
d.addCallback(lambda data_code_headers:
|
||||
self.failIf(data_code_headers[2].hasHeader("etag"), target))
|
||||
return d
|
||||
def _yes_etag(uri, t):
|
||||
target = "/uri/%s?t=%s" % (uri, t)
|
||||
target = "/uri/%s?t=%s" % (unicode(uri, "ascii"), t)
|
||||
d = self.GET(target, return_response=True, followRedirect=True)
|
||||
d.addCallback(lambda data_code_headers:
|
||||
self.failUnless(data_code_headers[2].hasHeader("etag"), target))
|
||||
|
@ -186,7 +186,7 @@ def convert_children_json(nodemaker, children_json):
|
||||
children = {}
|
||||
if children_json:
|
||||
data = json.loads(children_json)
|
||||
for (namex, (ctype, propdict)) in data.iteritems():
|
||||
for (namex, (ctype, propdict)) in data.items():
|
||||
namex = unicode(namex)
|
||||
writecap = to_bytes(propdict.get("rw_uri"))
|
||||
readcap = to_bytes(propdict.get("ro_uri"))
|
||||
|
@ -224,7 +224,7 @@ class DirectoryNodeHandler(ReplaceMeMixin, Resource, object):
|
||||
FIXED_OUTPUT_TYPES = ["", "json", "uri", "readonly-uri"]
|
||||
if not self.node.is_mutable() and t in FIXED_OUTPUT_TYPES:
|
||||
si = self.node.get_storage_index()
|
||||
if si and req.setETag('DIR:%s-%s' % (base32.b2a(si), t or "")):
|
||||
if si and req.setETag(b'DIR:%s-%s' % (base32.b2a(si), t.encode("ascii") or b"")):
|
||||
return b""
|
||||
|
||||
if not t:
|
||||
|
@ -188,8 +188,8 @@ class FileNodeHandler(Resource, ReplaceMeMixin, object):
|
||||
# if the client already has the ETag then we can
|
||||
# short-circuit the whole process.
|
||||
si = self.node.get_storage_index()
|
||||
if si and req.setETag('%s-%s' % (base32.b2a(si), t or "")):
|
||||
return ""
|
||||
if si and req.setETag(b'%s-%s' % (base32.b2a(si), t.encode("ascii") or b"")):
|
||||
return b""
|
||||
|
||||
if not t:
|
||||
# just get the contents
|
||||
|
Loading…
x
Reference in New Issue
Block a user