Changeset View
Changeset View
Standalone View
Standalone View
swh/objstorage/tests/test_multiplexer_filter.py
Show All 22 Lines | |||||
class MixinTestReadFilter(unittest.TestCase): | class MixinTestReadFilter(unittest.TestCase): | ||||
# Read only filter should not allow writing | # Read only filter should not allow writing | ||||
def setUp(self): | def setUp(self): | ||||
super().setUp() | super().setUp() | ||||
self.tmpdir = tempfile.mkdtemp() | self.tmpdir = tempfile.mkdtemp() | ||||
pstorage = { | pstorage = { | ||||
"cls": "pathslicing", | "cls": "pathslicing", | ||||
"args": {"root": self.tmpdir, "slicing": "0:5"}, | "root": self.tmpdir, | ||||
"slicing": "0:5", | |||||
} | } | ||||
base_storage = get_objstorage(**pstorage) | base_storage = get_objstorage(**pstorage) | ||||
base_storage.id = compute_hash | base_storage.id = compute_hash | ||||
self.storage = get_objstorage( | self.storage = get_objstorage( | ||||
"filtered", {"storage_conf": pstorage, "filters_conf": [read_only()]} | "filtered", storage_conf=pstorage, filters_conf=[read_only()] | ||||
) | ) | ||||
self.valid_content = b"pre-existing content" | self.valid_content = b"pre-existing content" | ||||
self.invalid_content = b"invalid_content" | self.invalid_content = b"invalid_content" | ||||
self.true_invalid_content = b"Anything that is not correct" | self.true_invalid_content = b"Anything that is not correct" | ||||
self.absent_content = b"non-existent content" | self.absent_content = b"non-existent content" | ||||
# Create a valid content. | # Create a valid content. | ||||
self.valid_id = base_storage.add(self.valid_content) | self.valid_id = base_storage.add(self.valid_content) | ||||
# Create an invalid id and add a content with it. | # Create an invalid id and add a content with it. | ||||
▲ Show 20 Lines • Show All 287 Lines • Show Last 20 Lines |