@@ -371,10 +371,13 @@ def test_root_rotation_max(self):
371371  def  test_root_rotation_missing_keys (self ):
372372    repository  =  repo_tool .load_repository (self .repository_directory )
373373
374-     # A partially written root.json (threshold = 1, and not signed in this 
375-     # case) causes an invalid root chain later. 
374+     # A partially written root.json (threshold = 2, and signed with only 1 key) 
375+     # causes an invalid root chain later. 
376+     repository .root .threshold  =  2 
377+     repository .root .load_signing_key (self .role_keys ['root' ]['private' ])
376378    repository .snapshot .load_signing_key (self .role_keys ['snapshot' ]['private' ])
377379    repository .timestamp .load_signing_key (self .role_keys ['timestamp' ]['private' ])
380+ 
378381    repository .write ('root' )
379382    repository .write ('snapshot' )
380383    repository .write ('timestamp' )
@@ -385,9 +388,9 @@ def test_root_rotation_missing_keys(self):
385388                    os .path .join (self .repository_directory , 'metadata' ))
386389
387390    # Create a new, valid root.json. 
388-     repository .root .threshold  =  2 
391+     # Still not valid, because it is not written with a threshold of 2 
392+     # previous keys 
389393    repository .root .add_verification_key (self .role_keys ['role1' ]['public' ])
390-     repository .root .load_signing_key (self .role_keys ['root' ]['private' ])
391394    repository .root .load_signing_key (self .role_keys ['role1' ]['private' ])
392395
393396    repository .writeall ()
0 commit comments