[#431] acl: Fix test backward compatibility
Signed-off-by: Denis Kirillov <d.kirillov@yadro.com>
This commit is contained in:
parent
9637479d3b
commit
313ee45657
1 changed files with 15 additions and 5 deletions
|
@ -7,6 +7,7 @@ import (
|
|||
"crypto/sha256"
|
||||
"encoding/hex"
|
||||
"encoding/json"
|
||||
"encoding/xml"
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
|
@ -1371,11 +1372,20 @@ func TestPutObjectACLBackwardCompatibility(t *testing.T) {
|
|||
putObjectWithHeadersBase(hc, bktName, objName, map[string]string{api.AmzACL: basicACLPublic}, info.Box, nil)
|
||||
|
||||
aclRes := getObjectACL(hc, bktName, objName)
|
||||
require.Len(t, aclRes.AccessControlList, 2)
|
||||
require.Equal(t, hex.EncodeToString(info.Key.PublicKey().Bytes()), aclRes.AccessControlList[0].Grantee.ID)
|
||||
require.Equal(t, aclFullControl, aclRes.AccessControlList[0].Permission)
|
||||
require.Equal(t, allUsersGroup, aclRes.AccessControlList[1].Grantee.URI)
|
||||
require.Equal(t, aclFullControl, aclRes.AccessControlList[1].Permission)
|
||||
xmlName := xml.Name{
|
||||
Space: "http://s3.amazonaws.com/doc/2006-03-01/",
|
||||
Local: "Grantee",
|
||||
}
|
||||
require.ElementsMatch(t, aclRes.AccessControlList, []*Grant{
|
||||
{
|
||||
Grantee: &Grantee{XMLName: xmlName, ID: hex.EncodeToString(info.Key.PublicKey().Bytes())},
|
||||
Permission: aclFullControl,
|
||||
},
|
||||
{
|
||||
Grantee: &Grantee{XMLName: xmlName, URI: allUsersGroup},
|
||||
Permission: aclFullControl,
|
||||
},
|
||||
})
|
||||
|
||||
aclBody := &AccessControlPolicy{}
|
||||
putObjectACLBase(hc, bktName, objName, info.Box, nil, aclBody)
|
||||
|
|
Loading…
Reference in a new issue