Changeset View
Changeset View
Standalone View
Standalone View
swh/objstorage/tests/test_objstorage_pathslicing.py
Show All 32 Lines | def setUp(self): | ||||
) | ) | ||||
def tearDown(self): | def tearDown(self): | ||||
super().tearDown() | super().tearDown() | ||||
shutil.rmtree(self.tmpdir) | shutil.rmtree(self.tmpdir) | ||||
def content_path(self, obj_id): | def content_path(self, obj_id): | ||||
hex_obj_id = hashutil.hash_to_hex(obj_id) | hex_obj_id = hashutil.hash_to_hex(obj_id) | ||||
return self.storage._obj_path(hex_obj_id) | return self.storage.slicer.get_path(hex_obj_id) | ||||
def test_iter(self): | def test_iter(self): | ||||
content, obj_id = self.hash_content(b"iter") | content, obj_id = self.hash_content(b"iter") | ||||
self.assertEqual(list(iter(self.storage)), []) | self.assertEqual(list(iter(self.storage)), []) | ||||
self.storage.add(content, obj_id=obj_id) | self.storage.add(content, obj_id=obj_id) | ||||
self.assertEqual(list(iter(self.storage)), [obj_id]) | self.assertEqual(list(iter(self.storage)), [obj_id]) | ||||
def test_len(self): | def test_len(self): | ||||
▲ Show 20 Lines • Show All 114 Lines • Show Last 20 Lines |