From 313ee456575f1f6c5a03f126c46780b417ed8113 Mon Sep 17 00:00:00 2001 From: Denis Kirillov Date: Wed, 17 Jul 2024 09:32:42 +0300 Subject: [PATCH] [#431] acl: Fix test backward compatibility Signed-off-by: Denis Kirillov --- api/handler/acl_test.go | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/api/handler/acl_test.go b/api/handler/acl_test.go index 1d66850..cb4a07f 100644 --- a/api/handler/acl_test.go +++ b/api/handler/acl_test.go @@ -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)