Closer to passing tests.

This commit is contained in:
Itamar Turner-Trauring 2020-09-25 13:28:59 -04:00
parent d8c9affccb
commit 565c48045e
3 changed files with 7 additions and 7 deletions

View File

@ -203,7 +203,7 @@ class CHKUploadHelper(Referenceable, upload.CHKUploader):
def _finished(self, ur): def _finished(self, ur):
assert interfaces.IUploadResults.providedBy(ur), ur assert interfaces.IUploadResults.providedBy(ur), ur
vcapstr = ur.get_verifycapstr() vcapstr = ur.get_verifycapstr()
precondition(isinstance(vcapstr, str), vcapstr) precondition(isinstance(vcapstr, bytes), vcapstr)
v = uri.from_string(vcapstr) v = uri.from_string(vcapstr)
f_times = self._fetcher.get_times() f_times = self._fetcher.get_times()
@ -492,9 +492,9 @@ class Helper(Referenceable):
# helper at random. # helper at random.
name = "helper" name = "helper"
VERSION = { "http://allmydata.org/tahoe/protocols/helper/v1" : VERSION = { b"http://allmydata.org/tahoe/protocols/helper/v1" :
{ }, { },
"application-version": str(allmydata.__full_version__), b"application-version": allmydata.__full_version__.encode("utf-8"),
} }
MAX_UPLOAD_STATUSES = 10 MAX_UPLOAD_STATUSES = 10

View File

@ -1816,15 +1816,15 @@ class Uploader(service.MultiService, log.PrefixingLogMixin):
def _got_helper(self, helper): def _got_helper(self, helper):
self.log("got helper connection, getting versions") self.log("got helper connection, getting versions")
default = { "http://allmydata.org/tahoe/protocols/helper/v1" : default = { b"http://allmydata.org/tahoe/protocols/helper/v1" :
{ }, { },
"application-version": b"unknown: no get_version()", b"application-version": b"unknown: no get_version()",
} }
d = add_version_to_remote_reference(helper, default) d = add_version_to_remote_reference(helper, default)
d.addCallback(self._got_versioned_helper) d.addCallback(self._got_versioned_helper)
def _got_versioned_helper(self, helper): def _got_versioned_helper(self, helper):
needed = "http://allmydata.org/tahoe/protocols/helper/v1" needed = b"http://allmydata.org/tahoe/protocols/helper/v1"
if needed not in helper.version: if needed not in helper.version:
raise InsufficientVersionError(needed, helper.version) raise InsufficientVersionError(needed, helper.version)
self._helper = helper self._helper = helper

View File

@ -218,7 +218,7 @@ class AssistedUpload(unittest.TestCase):
d.addCallback(_ready) d.addCallback(_ready)
def _uploaded(results): def _uploaded(results):
the_uri = results.get_uri() the_uri = results.get_uri()
assert "CHK" in the_uri assert b"CHK" in the_uri
d.addCallback(_uploaded) d.addCallback(_uploaded)
def _check_empty(res): def _check_empty(res):