Skip to content

Commit

Permalink
stash
Browse files Browse the repository at this point in the history
  • Loading branch information
ethan-lowman-dd committed Jan 11, 2022
1 parent 3383f3d commit b8faafb
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
9 changes: 8 additions & 1 deletion client/delegations_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package client

import (
"crypto/sha256"
"encoding/json"
"fmt"
"io"
Expand All @@ -26,7 +27,13 @@ func TestGetTargetMeta(t *testing.T) {

f, err := c.getTargetFileMeta("f.txt")
assert.Nil(t, err)
assert.Equal(t, int64(15), f.Length)
hash := sha256.Sum256([]byte("Contents: f.txt"))
assert.Equal(t, data.HexBytes(hash[:]), f.Hashes["sha256"])

f, err = c.getTargetFileMeta("targets.txt")
assert.Nil(t, err)
hash = sha256.Sum256([]byte("Contents: targets.txt"))
assert.Equal(t, data.HexBytes(hash[:]), f.Hashes["sha256"])
}

func TestMaxDelegations(t *testing.T) {
Expand Down
10 changes: 5 additions & 5 deletions internal/targets/delegation.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package targets

import (
"github.com/theupdateframework/go-tuf/data"
"github.com/theupdateframework/go-tuf/internal/sets"
"github.com/theupdateframework/go-tuf/verify"
)

Expand All @@ -21,11 +20,12 @@ type delegationsIterator struct {
// NewDelegationsIterator initialises an iterator with a first step
// on top level targets.
func NewDelegationsIterator(target string, topLevelKeysDB *verify.DB) *delegationsIterator {
role := topLevelKeysDB.GetRole("targets")
// role := topLevelKeysDB.GetRole("targets")
keyIDs := []string{}
if role != nil {
keyIDs = sets.StringSetToSlice(role.KeyIDs)
}

// if role != nil {
// keyIDs = sets.StringSetToSlice(role.KeyIDs)
// }

i := &delegationsIterator{
target: target,
Expand Down

0 comments on commit b8faafb

Please sign in to comment.