mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2024-12-26 16:11:08 +00:00
make some tests pass
This commit is contained in:
parent
b0b2d16383
commit
bd6145a5cb
@ -194,7 +194,7 @@ class CHKFile(testutil.ReallyEqualMixin, unittest.TestCase):
|
|||||||
|
|
||||||
class Extension(testutil.ReallyEqualMixin, unittest.TestCase):
|
class Extension(testutil.ReallyEqualMixin, unittest.TestCase):
|
||||||
def test_pack(self):
|
def test_pack(self):
|
||||||
data = {"stuff": "value",
|
data = {"stuff": b"value",
|
||||||
"size": 12,
|
"size": 12,
|
||||||
"needed_shares": 3,
|
"needed_shares": 3,
|
||||||
"big_hash": hashutil.tagged_hash(b"foo", b"bar"),
|
"big_hash": hashutil.tagged_hash(b"foo", b"bar"),
|
||||||
@ -230,7 +230,7 @@ class Unknown(testutil.ReallyEqualMixin, unittest.TestCase):
|
|||||||
self.failUnless(isinstance(u2.get_error(), CapConstraintError))
|
self.failUnless(isinstance(u2.get_error(), CapConstraintError))
|
||||||
|
|
||||||
# Future caps might have non-ASCII chars in them. (Or maybe not, who can tell about the future?)
|
# Future caps might have non-ASCII chars in them. (Or maybe not, who can tell about the future?)
|
||||||
future_uri = u"I am a cap from the \u263A future. Whatever you ".encode('utf-8')
|
future_uri = u"I am a cap from the \u263A future. Whatever you "
|
||||||
u = uri.from_string(future_uri)
|
u = uri.from_string(future_uri)
|
||||||
self.failUnless(isinstance(u, uri.UnknownURI))
|
self.failUnless(isinstance(u, uri.UnknownURI))
|
||||||
self.failUnlessReallyEqual(u.to_string(), future_uri)
|
self.failUnlessReallyEqual(u.to_string(), future_uri)
|
||||||
@ -425,7 +425,7 @@ class Mutable(testutil.ReallyEqualMixin, unittest.TestCase):
|
|||||||
self.failIf(u2.is_readonly())
|
self.failIf(u2.is_readonly())
|
||||||
self.failUnless(u2.is_mutable())
|
self.failUnless(u2.is_mutable())
|
||||||
|
|
||||||
cap3 = cap+":"+os.urandom(40) # parse *that*!
|
cap3 = cap+":"+str(os.urandom(40)) # parse *that*!
|
||||||
u3 = uri.WriteableMDMFFileURI.init_from_string(cap3)
|
u3 = uri.WriteableMDMFFileURI.init_from_string(cap3)
|
||||||
self.failUnlessReallyEqual(self.writekey, u3.writekey)
|
self.failUnlessReallyEqual(self.writekey, u3.writekey)
|
||||||
self.failUnlessReallyEqual(self.fingerprint, u3.fingerprint)
|
self.failUnlessReallyEqual(self.fingerprint, u3.fingerprint)
|
||||||
|
@ -906,7 +906,7 @@ def pack_extension(data):
|
|||||||
value = data[k]
|
value = data[k]
|
||||||
if isinstance(value, int):
|
if isinstance(value, int):
|
||||||
value = "%d" % value
|
value = "%d" % value
|
||||||
assert isinstance(value, str), k
|
assert isinstance(value, bytes), k
|
||||||
assert re.match(r'^[a-zA-Z_\-]+$', k)
|
assert re.match(r'^[a-zA-Z_\-]+$', k)
|
||||||
pieces.append(k + ':' + hashutil.netstring(value))
|
pieces.append(k + ':' + hashutil.netstring(value))
|
||||||
uri_extension = ''.join(pieces)
|
uri_extension = ''.join(pieces)
|
||||||
|
Loading…
Reference in New Issue
Block a user