[#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"
|
"crypto/sha256"
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"encoding/xml"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
@ -1371,11 +1372,20 @@ func TestPutObjectACLBackwardCompatibility(t *testing.T) {
|
||||||
putObjectWithHeadersBase(hc, bktName, objName, map[string]string{api.AmzACL: basicACLPublic}, info.Box, nil)
|
putObjectWithHeadersBase(hc, bktName, objName, map[string]string{api.AmzACL: basicACLPublic}, info.Box, nil)
|
||||||
|
|
||||||
aclRes := getObjectACL(hc, bktName, objName)
|
aclRes := getObjectACL(hc, bktName, objName)
|
||||||
require.Len(t, aclRes.AccessControlList, 2)
|
xmlName := xml.Name{
|
||||||
require.Equal(t, hex.EncodeToString(info.Key.PublicKey().Bytes()), aclRes.AccessControlList[0].Grantee.ID)
|
Space: "http://s3.amazonaws.com/doc/2006-03-01/",
|
||||||
require.Equal(t, aclFullControl, aclRes.AccessControlList[0].Permission)
|
Local: "Grantee",
|
||||||
require.Equal(t, allUsersGroup, aclRes.AccessControlList[1].Grantee.URI)
|
}
|
||||||
require.Equal(t, aclFullControl, aclRes.AccessControlList[1].Permission)
|
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{}
|
aclBody := &AccessControlPolicy{}
|
||||||
putObjectACLBase(hc, bktName, objName, info.Box, nil, aclBody)
|
putObjectACLBase(hc, bktName, objName, info.Box, nil, aclBody)
|
||||||
|
|
Loading…
Reference in a new issue