@@ -357,10 +357,13 @@ def test_root_rotation_max(self):
357
357
def test_root_rotation_missing_keys (self ):
358
358
repository = repo_tool .load_repository (self .repository_directory )
359
359
360
- # A partially written root.json (threshold = 1, and not signed in this
361
- # case) causes an invalid root chain later.
360
+ # A partially written root.json (threshold = 2, and signed with only 1 key)
361
+ # causes an invalid root chain later.
362
+ repository .root .threshold = 2
363
+ repository .root .load_signing_key (self .role_keys ['root' ]['private' ])
362
364
repository .snapshot .load_signing_key (self .role_keys ['snapshot' ]['private' ])
363
365
repository .timestamp .load_signing_key (self .role_keys ['timestamp' ]['private' ])
366
+
364
367
repository .write ('root' )
365
368
repository .write ('snapshot' )
366
369
repository .write ('timestamp' )
@@ -371,9 +374,9 @@ def test_root_rotation_missing_keys(self):
371
374
os .path .join (self .repository_directory , 'metadata' ))
372
375
373
376
# Create a new, valid root.json.
374
- repository .root .threshold = 2
377
+ # Still not valid, because it is not written with a threshold of 2
378
+ # previous keys
375
379
repository .root .add_verification_key (self .role_keys ['role1' ]['public' ])
376
- repository .root .load_signing_key (self .role_keys ['root' ]['private' ])
377
380
repository .root .load_signing_key (self .role_keys ['role1' ]['private' ])
378
381
379
382
repository .writeall ()
0 commit comments