Skip to content

Commit

Permalink
added test
Browse files Browse the repository at this point in the history
  • Loading branch information
alexgao001 committed Dec 29, 2023
1 parent c0aec52 commit 6e9c2f6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions x/permission/types/keys_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ func TestPrefixKeyCollision(t *testing.T) {

// collision, the prefix bytes of resourceID2 has included all prefix bytes generated by resourceID1
assert.True(t, strings.Contains(
hex.EncodeToString(PolicyForAccountPrefix(resourceID2, resource.RESOURCE_TYPE_BUCKET)),
hex.EncodeToString(PolicyForAccountPrefix(resourceID1, resource.RESOURCE_TYPE_BUCKET)),
hex.EncodeToString(PolicyForAccountPrefix(resourceID2, resource.RESOURCE_TYPE_BUCKET, false)),
hex.EncodeToString(PolicyForAccountPrefix(resourceID1, resource.RESOURCE_TYPE_BUCKET, false)),
))

assert.False(t, strings.Contains(
hex.EncodeToString(PolicyForAccountPrefixV2(resourceID2, resource.RESOURCE_TYPE_BUCKET)),
hex.EncodeToString(PolicyForAccountPrefixV2(resourceID1, resource.RESOURCE_TYPE_BUCKET)),
hex.EncodeToString(PolicyForAccountPrefix(resourceID2, resource.RESOURCE_TYPE_BUCKET, true)),
hex.EncodeToString(PolicyForAccountPrefix(resourceID1, resource.RESOURCE_TYPE_BUCKET, true)),
))
}

0 comments on commit 6e9c2f6

Please sign in to comment.