Merge "Add assertion to test_consolidate_hashes_raises_exception"
This commit is contained in:
@@ -6395,7 +6395,7 @@ class TestSuffixHashes(unittest.TestCase):
|
||||
open_loc = '__builtin__.open' if six.PY2 else 'builtins.open'
|
||||
with mock.patch(open_loc, watch_open):
|
||||
self.assertTrue(os.path.exists(inv_file))
|
||||
# no new suffixes get invalided... so no write iop
|
||||
# no new suffixes get invalidated... so no write iop
|
||||
df_mgr.get_hashes('sda1', '0', [], policy)
|
||||
# each file is opened once to read
|
||||
expected = {
|
||||
@@ -6718,6 +6718,7 @@ class TestSuffixHashes(unittest.TestCase):
|
||||
self.assertEqual(warnings, ["Unable to read %r" % hashes_file])
|
||||
|
||||
# repeat with pre-existing hashes.pkl
|
||||
self.logger.clear()
|
||||
with mock.patch.object(df_mgr, '_hash_suffix',
|
||||
return_value='new fake hash'):
|
||||
with mock.patch.object(df_mgr, 'consolidate_hashes',
|
||||
@@ -6735,6 +6736,10 @@ class TestSuffixHashes(unittest.TestCase):
|
||||
self.assertTrue(found_hashes.pop('valid'))
|
||||
self.assertEqual(hashes, found_hashes)
|
||||
|
||||
# sanity check log warning
|
||||
warnings = self.logger.get_lines_for_level('warning')
|
||||
self.assertEqual(warnings, ["Unable to read %r" % hashes_file])
|
||||
|
||||
# invalidate_hash tests - error handling
|
||||
|
||||
def test_invalidate_hash_bad_pickle(self):
|
||||
|
||||
Reference in New Issue
Block a user