async def test_05_save(self): keys = list(self.files.keys()) random.shuffle(keys) for filename in keys[:self.FILE_COUNT // 4]: text = Generate.lipsum() await self.archive.save(filename, text) self.files[filename] = text
def setUpClass(cls) -> None: """Prepare class-wise environment""" random.seed(0) cls.dir = TemporaryDirectory() cls.secret = os.urandom(32) cls.filename = Path(cls.dir.name, "test.ar7") if cls.filename.exists(): raise OSError("File shouldn't be there.") cls.owner = Generate.uuid() cls.archive = Archive7.setup(cls.filename, cls.secret, owner=cls.owner) cls.files = dict() cls.links = dict() for _ in range(cls.FILE_COUNT): filename = PurePosixPath(random.choice(LIPSUM_PATH), Generate.filename()) cls.files[filename] = Generate.lipsum() cls.archive.close()