[#431] acl: Fix test backward compatibility
All checks were successful
/ Builds (1.21) (pull_request) Successful in 1m44s
/ Builds (1.22) (pull_request) Successful in 2m16s
/ DCO (pull_request) Successful in 2m28s
/ Vulncheck (pull_request) Successful in 2m55s
/ Lint (pull_request) Successful in 6m1s
/ Tests (1.21) (pull_request) Successful in 3m15s
/ Tests (1.22) (pull_request) Successful in 3m5s

Signed-off-by: Denis Kirillov <d.kirillov@yadro.com>
This commit is contained in:
Denis Kirillov 2024-07-17 09:32:42 +03:00
parent 12c38d2819
commit 0d1131965e

View file

@ -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)