test(01-07): reject copy-state identities without backing artifacts
This commit is contained in:
1 parent
a821754b67
commit
48fca0df52
1 file changed
+17
@@ -166,6 +166,23 @@ class FidelityScenarios(unittest.TestCase):
|
||||
value['continuity']['retained_copy_sha256'] = value['identity'][name]['sha256']
|
||||
self.assertEqual(api.audit_scenarios(self.protocol(), [(value, root)])['accepted'], 0)
|
||||
|
||||
def test_copy_state_requires_backing_files_for_both_lifetimes(self):
|
||||
for lifetime in ('fresh', 'retained'):
|
||||
for name in ('copy_pre', 'retained_copy') if lifetime == 'retained' else ('copy_pre',):
|
||||
for defect in ('hash-only', 'missing-file', 'wrong-size'):
|
||||
with self.subTest(lifetime=lifetime, name=name, defect=defect):
|
||||
value, root = self.receipt(lifetime + '-natural-ordinary', 'dialogue-return')
|
||||
item = value['identity'][name]
|
||||
if defect == 'hash-only':
|
||||
value['identity'][name] = {'sha256': item['sha256']}
|
||||
elif defect == 'missing-file':
|
||||
(root / item['path']).unlink()
|
||||
else:
|
||||
item['size'] += 1
|
||||
result = api.audit_scenarios(self.protocol(), [(value, root)])
|
||||
self.assertEqual(result['accepted'], 0)
|
||||
self.assertTrue(result['invalid'])
|
||||
|
||||
def test_reset_timestamps_fail(self):
|
||||
value, root = self.receipt()
|
||||
value['events'][-1]['elapsed_seconds'] = 0
|
||||
|
||||
Reference in new issue
Block a user