|
@ -487,8 +487,9 @@ func TestDetermineReqGrants(t *testing.T) { |
|
|
|
|
|
|
|
|
func TestAssembleEntryWithAcp(t *testing.T) { |
|
|
func TestAssembleEntryWithAcp(t *testing.T) { |
|
|
defaultOwner := "admin" |
|
|
defaultOwner := "admin" |
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
//case1
|
|
|
//case1
|
|
|
|
|
|
//assemble with non-empty grants
|
|
|
expectOwner := "accountS" |
|
|
expectOwner := "accountS" |
|
|
expectGrants := []*s3.Grant{ |
|
|
expectGrants := []*s3.Grant{ |
|
|
{ |
|
|
{ |
|
@ -512,22 +513,19 @@ func TestAssembleEntryWithAcp(t *testing.T) { |
|
|
if !grantsEquals(resultGrants, expectGrants) { |
|
|
if !grantsEquals(resultGrants, expectGrants) { |
|
|
t.Fatal("grants not expect") |
|
|
t.Fatal("grants not expect") |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
//case2
|
|
|
//case2
|
|
|
entry := &filer_pb.Entry{} |
|
|
|
|
|
|
|
|
//assemble with empty grants (override)
|
|
|
AssembleEntryWithAcp(entry, "", nil) |
|
|
AssembleEntryWithAcp(entry, "", nil) |
|
|
|
|
|
|
|
|
resultOwner := GetAcpOwner(entry.Extended, defaultOwner) |
|
|
|
|
|
|
|
|
resultOwner = GetAcpOwner(entry.Extended, defaultOwner) |
|
|
if resultOwner != defaultOwner { |
|
|
if resultOwner != defaultOwner { |
|
|
t.Fatalf("owner not expect") |
|
|
t.Fatalf("owner not expect") |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
resultGrants := GetAcpGrants(entry.Extended) |
|
|
|
|
|
|
|
|
resultGrants = GetAcpGrants(entry.Extended) |
|
|
if len(resultGrants) != 0 { |
|
|
if len(resultGrants) != 0 { |
|
|
t.Fatal("grants not expect") |
|
|
t.Fatal("grants not expect") |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|