[#430] acl: Fix test backward compatibility
All checks were successful
/ DCO (pull_request) Successful in 2m25s
/ Vulncheck (pull_request) Successful in 2m42s
/ Builds (1.21) (pull_request) Successful in 2m50s
/ Builds (1.22) (pull_request) Successful in 2m49s
/ Lint (pull_request) Successful in 5m12s
/ Tests (1.21) (pull_request) Successful in 2m38s
/ Tests (1.22) (pull_request) Successful in 2m31s

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 9e8cf0edaf
commit 6dc0b389be

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)