File tree Expand file tree Collapse file tree 2 files changed +13
-6
lines changed Expand file tree Collapse file tree 2 files changed +13
-6
lines changed Original file line number Diff line number Diff line change 1
1
package client
2
2
3
3
import (
4
+ "crypto/sha256"
4
5
"encoding/json"
5
6
"fmt"
6
7
"io"
@@ -26,7 +27,13 @@ func TestGetTargetMeta(t *testing.T) {
26
27
27
28
f , err := c .getTargetFileMeta ("f.txt" )
28
29
assert .Nil (t , err )
29
- assert .Equal (t , int64 (15 ), f .Length )
30
+ hash := sha256 .Sum256 ([]byte ("Contents: f.txt" ))
31
+ assert .Equal (t , data .HexBytes (hash [:]), f .Hashes ["sha256" ])
32
+
33
+ f , err = c .getTargetFileMeta ("targets.txt" )
34
+ assert .Nil (t , err )
35
+ hash = sha256 .Sum256 ([]byte ("Contents: targets.txt" ))
36
+ assert .Equal (t , data .HexBytes (hash [:]), f .Hashes ["sha256" ])
30
37
}
31
38
32
39
func TestMaxDelegations (t * testing.T ) {
Original file line number Diff line number Diff line change @@ -2,7 +2,6 @@ package targets
2
2
3
3
import (
4
4
"github.com/theupdateframework/go-tuf/data"
5
- "github.com/theupdateframework/go-tuf/internal/sets"
6
5
"github.com/theupdateframework/go-tuf/verify"
7
6
)
8
7
@@ -21,11 +20,12 @@ type delegationsIterator struct {
21
20
// NewDelegationsIterator initialises an iterator with a first step
22
21
// on top level targets.
23
22
func NewDelegationsIterator (target string , topLevelKeysDB * verify.DB ) * delegationsIterator {
24
- role := topLevelKeysDB .GetRole ("targets" )
23
+ // role := topLevelKeysDB.GetRole("targets")
25
24
keyIDs := []string {}
26
- if role != nil {
27
- keyIDs = sets .StringSetToSlice (role .KeyIDs )
28
- }
25
+
26
+ // if role != nil {
27
+ // keyIDs = sets.StringSetToSlice(role.KeyIDs)
28
+ // }
29
29
30
30
i := & delegationsIterator {
31
31
target : target ,
You can’t perform that action at this time.
0 commit comments