@@ -687,13 +687,15 @@ func (rs *RepoSuite) TestCommit(c *C) {
687687 // commit without root.json
688688 c .Assert (r .Commit (), DeepEquals , ErrMissingMetadata {"root.json" })
689689
690- // commit without targets.json
690+ // Init should create targets.json, but not signed yet
691+ r .Init (false )
692+ c .Assert (r .Commit (), DeepEquals , ErrMissingMetadata {"snapshot.json" })
693+
691694 genKey (c , r , "root" )
692- c .Assert (r .Commit (), DeepEquals , ErrMissingMetadata {"targets.json" })
693695
694696 // commit without snapshot.json
695697 genKey (c , r , "targets" )
696- c .Assert (r .AddTarget ( "foo.txt" , nil ), IsNil )
698+ c .Assert (r .Sign ( "targets.json" ), IsNil )
697699 c .Assert (r .Commit (), DeepEquals , ErrMissingMetadata {"snapshot.json" })
698700
699701 // commit without timestamp.json
@@ -714,12 +716,12 @@ func (rs *RepoSuite) TestCommit(c *C) {
714716 // commit with an invalid root hash in snapshot.json due to new key creation
715717 genKey (c , r , "targets" )
716718 c .Assert (r .Sign ("targets.json" ), IsNil )
717- c .Assert (r .Commit (), DeepEquals , errors .New ("tuf: invalid targets.json in snapshot.json: wrong length, expected 511 got 725 " ))
719+ c .Assert (r .Commit (), DeepEquals , errors .New ("tuf: invalid targets.json in snapshot.json: wrong length, expected 338 got 552 " ))
718720
719721 // commit with an invalid targets hash in snapshot.json
720722 c .Assert (r .Snapshot (), IsNil )
721723 c .Assert (r .AddTarget ("bar.txt" , nil ), IsNil )
722- c .Assert (r .Commit (), DeepEquals , errors .New ("tuf: invalid targets.json in snapshot.json: wrong length, expected 725 got 899 " ))
724+ c .Assert (r .Commit (), DeepEquals , errors .New ("tuf: invalid targets.json in snapshot.json: wrong length, expected 552 got 725 " ))
723725
724726 // commit with an invalid timestamp
725727 c .Assert (r .Snapshot (), IsNil )
0 commit comments