Exemplo n.º 1
0
 def test_symlink_roundtrip(self):
     meta = PathMeta(id='N:helloworld:123', size=10, checksum=b'1;o2j\x9912\xffo3ij\x01123,asdf.')
     path = self.test_path
     path._cache = SymlinkCache(path, meta=meta)
     path.cache.meta = meta
     new_meta = path.cache.meta
     path.unlink()
     msg = '\n'.join([f'{k!r} {v!r} {getattr(new_meta, k)!r}' for k, v in meta.items()])
     assert meta == new_meta, msg
Exemplo n.º 2
0
 def _test_symlink_roundtrip_weird(self):
     path = LocalPathTest(test_base, 'testpath')  # FIXME random needed ...
     meta = PathMeta(id='N:helloworld:123', size=10, checksum=b'1;o2j\x9912\xffo3ij\x01123,asdf.')
     pure_symlink = PurePosixPath(path.name) / meta.as_symlink()
     path.symlink_to(pure_symlink)
     try:
         cache = SymlinkCache(path)
         new_meta = cache.meta
         msg = '\n'.join([f'{k!r} {v!r} {getattr(new_meta, k)!r}' for k, v in meta.items()])
         assert meta == new_meta, msg
     finally:
         path.unlink()