@@ -372,10 +372,13 @@ def test_root_rotation_max(self):
372372 def test_root_rotation_missing_keys (self ):
373373 repository = repo_tool .load_repository (self .repository_directory )
374374
375- # A partially written root.json (threshold = 1, and not signed in this
376- # case) causes an invalid root chain later.
375+ # A partially written root.json (threshold = 2, and signed with only 1 key)
376+ # causes an invalid root chain later.
377+ repository .root .threshold = 2
378+ repository .root .load_signing_key (self .role_keys ['root' ]['private' ])
377379 repository .snapshot .load_signing_key (self .role_keys ['snapshot' ]['private' ])
378380 repository .timestamp .load_signing_key (self .role_keys ['timestamp' ]['private' ])
381+
379382 repository .write ('root' )
380383 repository .write ('snapshot' )
381384 repository .write ('timestamp' )
@@ -386,9 +389,9 @@ def test_root_rotation_missing_keys(self):
386389 os .path .join (self .repository_directory , 'metadata' ))
387390
388391 # Create a new, valid root.json.
389- repository .root .threshold = 2
392+ # Still not valid, because it is not written with a threshold of 2
393+ # previous keys
390394 repository .root .add_verification_key (self .role_keys ['role1' ]['public' ])
391- repository .root .load_signing_key (self .role_keys ['root' ]['private' ])
392395 repository .root .load_signing_key (self .role_keys ['role1' ]['private' ])
393396
394397 repository .writeall ()
0 commit comments