|
@@ -669,3 +669,23 @@ class Test(unittest.TestCase): |
|
|
# a local ipfs gateway makes more sense than hitting a |
|
|
# a local ipfs gateway makes more sense than hitting a |
|
|
# public gateway |
|
|
# public gateway |
|
|
pass |
|
|
pass |
|
|
|
|
|
|
|
|
|
|
|
def test_filecorruption(self): |
|
|
|
|
|
cachedir = self.tempdir / 'cachedir' |
|
|
|
|
|
cachedir.mkdir() |
|
|
|
|
|
|
|
|
|
|
|
# that an existing file |
|
|
|
|
|
shutil.copy(self.fixtures / 'hello.py', cachedir) |
|
|
|
|
|
|
|
|
|
|
|
# is in the cache |
|
|
|
|
|
fdcas = FileDirCAS(cachedir) |
|
|
|
|
|
|
|
|
|
|
|
# that when refresh is surpressed |
|
|
|
|
|
fdcas.refresh_dir = lambda: None |
|
|
|
|
|
|
|
|
|
|
|
# and has a bogus hash |
|
|
|
|
|
fdcas._hashes['0000'] = cachedir / 'hello.py' |
|
|
|
|
|
|
|
|
|
|
|
# that when read raises an exception |
|
|
|
|
|
with self.assertRaises(ValueError): |
|
|
|
|
|
fdcas.fetch_data(urllib.parse.urlparse('hash://sha256/0000')) |