This commit is contained in:
Itamar Turner-Trauring 2021-01-28 12:00:15 -05:00
parent e5a7ea97c7
commit 90a47bb859
1 changed files with 11 additions and 11 deletions

View File

@ -2818,11 +2818,11 @@ class Web(WebMixin, WebErrorMixin, testutil.StallMixin, testutil.ReallyEqualMixi
# for immutable, it returns an "upload results page", and # for immutable, it returns an "upload results page", and
# the filecap is buried inside # the filecap is buried inside
line = [l for l in results.split(b"\n") if b"URI: " in l][0] line = [l for l in results.split(b"\n") if b"URI: " in l][0]
mo = re.search(r'<span>([^<]+)</span>', line) mo = re.search(br'<span>([^<]+)</span>', line)
filecap = mo.group(1) filecap = mo.group(1)
self.failUnless(filecap.startswith(uri_prefix), self.failUnless(filecap.startswith(uri_prefix),
(uri_prefix, filecap)) (uri_prefix, filecap))
return self.GET("/uri/%s?t=json" % filecap) return self.GET("/uri/%s?t=json" % unicode(filecap, "utf-8"))
d.addCallback(_got_results) d.addCallback(_got_results)
def _got_json(raw): def _got_json(raw):
data = json.loads(raw) data = json.loads(raw)
@ -2832,10 +2832,10 @@ class Web(WebMixin, WebErrorMixin, testutil.StallMixin, testutil.ReallyEqualMixi
d.addCallback(_got_json) d.addCallback(_got_json)
return d return d
d = defer.succeed(None) d = defer.succeed(None)
d.addCallback(_check_upload_unlinked, "chk", "URI:CHK") d.addCallback(_check_upload_unlinked, "chk", b"URI:CHK")
d.addCallback(_check_upload_unlinked, "CHK", "URI:CHK") d.addCallback(_check_upload_unlinked, "CHK", b"URI:CHK")
d.addCallback(_check_upload_unlinked, "sdmf", "URI:SSK") d.addCallback(_check_upload_unlinked, "sdmf", b"URI:SSK")
d.addCallback(_check_upload_unlinked, "mdmf", "URI:MDMF") d.addCallback(_check_upload_unlinked, "mdmf", b"URI:MDMF")
return d return d
@inlineCallbacks @inlineCallbacks
@ -2900,7 +2900,7 @@ class Web(WebMixin, WebErrorMixin, testutil.StallMixin, testutil.ReallyEqualMixi
d.addCallback(_got) d.addCallback(_got)
# now upload it again and make sure that the URI doesn't change # now upload it again and make sure that the URI doesn't change
NEWER_CONTENTS = self.NEWFILE_CONTENTS + "newer\n" NEWER_CONTENTS = self.NEWFILE_CONTENTS + b"newer\n"
d.addCallback(lambda res: d.addCallback(lambda res:
self.POST(self.public_url + "/foo", t="upload", self.POST(self.public_url + "/foo", t="upload",
mutable="true", mutable="true",
@ -2918,7 +2918,7 @@ class Web(WebMixin, WebErrorMixin, testutil.StallMixin, testutil.ReallyEqualMixi
d.addCallback(_got2) d.addCallback(_got2)
# upload a second time, using PUT instead of POST # upload a second time, using PUT instead of POST
NEW2_CONTENTS = NEWER_CONTENTS + "overwrite with PUT\n" NEW2_CONTENTS = NEWER_CONTENTS + b"overwrite with PUT\n"
d.addCallback(lambda res: d.addCallback(lambda res:
self.PUT(self.public_url + "/foo/new.txt", NEW2_CONTENTS)) self.PUT(self.public_url + "/foo/new.txt", NEW2_CONTENTS))
d.addCallback(self.failUnlessURIMatchesRWChild, fn, u"new.txt") d.addCallback(self.failUnlessURIMatchesRWChild, fn, u"new.txt")
@ -2934,7 +2934,7 @@ class Web(WebMixin, WebErrorMixin, testutil.StallMixin, testutil.ReallyEqualMixi
followRedirect=True)) followRedirect=True))
def _check_page(res): def _check_page(res):
# TODO: assert more about the contents # TODO: assert more about the contents
self.failUnlessIn("SSK", res) self.failUnlessIn(b"SSK", res)
return res return res
d.addCallback(_check_page) d.addCallback(_check_page)
@ -3012,7 +3012,7 @@ class Web(WebMixin, WebErrorMixin, testutil.StallMixin, testutil.ReallyEqualMixi
self.POST(self.public_url + "/foo", t="upload", self.POST(self.public_url + "/foo", t="upload",
mutable="true", mutable="true",
file=("new.txt", file=("new.txt",
"b" * (self.s.MUTABLE_SIZELIMIT+1)))) b"b" * (self.s.MUTABLE_SIZELIMIT+1))))
d.addErrback(self.dump_error) d.addErrback(self.dump_error)
return d return d
@ -3024,7 +3024,7 @@ class Web(WebMixin, WebErrorMixin, testutil.StallMixin, testutil.ReallyEqualMixi
# mutable files. # mutable files.
d = self.POST(self.public_url + "/foo", d = self.POST(self.public_url + "/foo",
t="upload", mutable="true", t="upload", mutable="true",
file=("new.txt", "b" * (self.s.MUTABLE_SIZELIMIT + 1))) file=("new.txt", b"b" * (self.s.MUTABLE_SIZELIMIT + 1)))
return d return d
def dump_error(self, f): def dump_error(self, f):