From d532eb710f7e067bce1afdde31204bc8484e7737 Mon Sep 17 00:00:00 2001 From: Denis Kirillov Date: Mon, 17 Jan 2022 15:36:10 +0300 Subject: [PATCH] [#306] Add test to check empty policy Signed-off-by: Denis Kirillov --- api/handler/put_test.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/api/handler/put_test.go b/api/handler/put_test.go index 4695900f..dbe02e37 100644 --- a/api/handler/put_test.go +++ b/api/handler/put_test.go @@ -2,9 +2,12 @@ package handler import ( "encoding/json" + "mime/multipart" + "net/http" "testing" "time" + "github.com/nspcc-dev/neofs-s3-gw/api" "github.com/stretchr/testify/require" ) @@ -86,3 +89,18 @@ func TestCustomJSONMarshal(t *testing.T) { 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) +}