mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2024-12-25 07:31:07 +00:00
add unit test asserting that allmydata.util.base32 matches rfc 3548
This commit is contained in:
parent
3eb95c1fad
commit
5942fca1e1
@ -11,6 +11,14 @@ from allmydata.util import assertutil, fileutil, testutil, deferredutil
|
|||||||
|
|
||||||
|
|
||||||
class Base32(unittest.TestCase):
|
class Base32(unittest.TestCase):
|
||||||
|
def test_b2a_matches_Pythons(self):
|
||||||
|
import base64
|
||||||
|
y = "\x12\x34\x45\x67\x89\x0a\xbc\xde\xf0"
|
||||||
|
x = base64.b32encode(y)
|
||||||
|
while x and x[-1] == '=':
|
||||||
|
x = x[:-1]
|
||||||
|
x = x.lower()
|
||||||
|
self.failUnlessEqual(base32.b2a(y), x)
|
||||||
def test_b2a(self):
|
def test_b2a(self):
|
||||||
self.failUnlessEqual(base32.b2a("\x12\x34"), "ci2a")
|
self.failUnlessEqual(base32.b2a("\x12\x34"), "ci2a")
|
||||||
def test_b2a_or_none(self):
|
def test_b2a_or_none(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user