mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-03-11 06:43:54 +00:00
Tests for allmydata.storage.common.
This commit is contained in:
parent
4590c1d1f5
commit
6983c79b26
@ -32,7 +32,8 @@ from allmydata.storage.server import StorageServer
|
||||
from allmydata.storage.mutable import MutableShareFile
|
||||
from allmydata.storage.immutable import BucketWriter, BucketReader
|
||||
from allmydata.storage.common import DataTooLargeError, storage_index_to_dir, \
|
||||
UnknownMutableContainerVersionError, UnknownImmutableContainerVersionError
|
||||
UnknownMutableContainerVersionError, UnknownImmutableContainerVersionError, \
|
||||
si_b2a, si_a2b
|
||||
from allmydata.storage.lease import LeaseInfo
|
||||
from allmydata.immutable.layout import WriteBucketProxy, WriteBucketProxy_v2, \
|
||||
ReadBucketProxy
|
||||
@ -52,6 +53,26 @@ from allmydata.storage_client import (
|
||||
from .common_py3 import FakeCanary, LoggingServiceParent, ShouldFailMixin
|
||||
|
||||
|
||||
class UtilTests(unittest.TestCase):
|
||||
"""Tests for allmydata.storage.common."""
|
||||
|
||||
def test_encoding(self):
|
||||
"""b2a/a2b are the same as base32."""
|
||||
s = b"\xFF HELLO \xF3"
|
||||
result = si_b2a(s)
|
||||
self.assertEqual(base32.b2a(s), result)
|
||||
self.assertEqual(si_a2b(result), s)
|
||||
|
||||
def test_storage_index_to_dir(self):
|
||||
"""storage_index_to_dir creates a native string path."""
|
||||
s = b"\xFF HELLO \xF3"
|
||||
path = storage_index_to_dir(s)
|
||||
parts = os.path.split(path)
|
||||
self.assertEqual(parts[0], parts[1][:2])
|
||||
self.assertIsInstance(path, native_str)
|
||||
|
||||
|
||||
|
||||
class FakeStatsProvider(object):
|
||||
def count(self, name, delta=1):
|
||||
pass
|
||||
|
Loading…
x
Reference in New Issue
Block a user