[#306] Add test to check empty policy

Signed-off-by: Denis Kirillov <denis@nspcc.ru>
This commit is contained in:
Denis Kirillov 2022-01-17 15:36:10 +03:00 committed by Alex Vanin
parent 76042f6728
commit d532eb710f

View file

@ -2,9 +2,12 @@ package handler
import ( import (
"encoding/json" "encoding/json"
"mime/multipart"
"net/http"
"testing" "testing"
"time" "time"
"github.com/nspcc-dev/neofs-s3-gw/api"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
) )
@ -86,3 +89,18 @@ func TestCustomJSONMarshal(t *testing.T) {
require.Equal(t, expectedPolicy, policy) require.Equal(t, expectedPolicy, policy)
} }
func TestEmptyPostPolicy(t *testing.T) {
r := &http.Request{
MultipartForm: &multipart.Form{
Value: map[string][]string{
"key": {"some-key"},
},
},
}
reqInfo := &api.ReqInfo{}
metadata := make(map[string]string)
_, err := checkPostPolicy(r, reqInfo, metadata)
require.NoError(t, err)
}