From 83cde4b69e95758e8a819cc5ab02ab9f1a3301b3 Mon Sep 17 00:00:00 2001 From: hantonelli Date: Sun, 31 Mar 2019 20:10:13 +0100 Subject: [PATCH] Fix tests. Improve code format. --- codegen/config/config.go | 2 +- handler/graphql.go | 1 - handler/graphql_test.go | 14 +++++++------- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/codegen/config/config.go b/codegen/config/config.go index 1e735a62435..1fc8ab46d4f 100644 --- a/codegen/config/config.go +++ b/codegen/config/config.go @@ -13,7 +13,7 @@ import ( "github.com/pkg/errors" "github.com/vektah/gqlparser" "github.com/vektah/gqlparser/ast" - "gopkg.in/yaml.v2" + yaml "gopkg.in/yaml.v2" ) type Config struct { diff --git a/handler/graphql.go b/handler/graphql.go index bbb680a6556..bf8fa4aed32 100644 --- a/handler/graphql.go +++ b/handler/graphql.go @@ -275,7 +275,6 @@ func WebsocketKeepAliveDuration(duration time.Duration) Option { const DefaultCacheSize = 1000 const DefaultConnectionKeepAlivePingInterval = 25 * time.Second - // DefaultUploadMaxMemory sets the total of maxMemory bytes used to parse a request body // as multipart/form-data in memory, with the remainder stored on disk in // temporary files. The default value is 32 MB. diff --git a/handler/graphql_test.go b/handler/graphql_test.go index dfac2d90bff..b7c7875633f 100644 --- a/handler/graphql_test.go +++ b/handler/graphql_test.go @@ -321,7 +321,7 @@ func TestProcessMultipart(t *testing.T) { Body: ioutil.NopCloser(new(bytes.Buffer)), } var reqParams params - err := processMultipart(req, &reqParams, DefaultFileMaxMemory) + err := processMultipart(req, &reqParams, DefaultUploadMaxMemory) require.NotNil(t, err) errMsg := err.Error() require.Equal(t, errMsg, "failed to parse multipart form") @@ -332,7 +332,7 @@ func TestProcessMultipart(t *testing.T) { req := createUploadRequest(t, operations, validMap, validFiles) var reqParams params - err := processMultipart(req, &reqParams, DefaultFileMaxMemory) + err := processMultipart(req, &reqParams, DefaultUploadMaxMemory) require.NotNil(t, err) require.Equal(t, err.Error(), "operations form field could not be decoded") }) @@ -342,7 +342,7 @@ func TestProcessMultipart(t *testing.T) { req := createUploadRequest(t, validOperations, mapData, validFiles) var reqParams params - err := processMultipart(req, &reqParams, DefaultFileMaxMemory) + err := processMultipart(req, &reqParams, DefaultUploadMaxMemory) require.NotNil(t, err) require.Equal(t, err.Error(), "map form field could not be decoded") }) @@ -352,7 +352,7 @@ func TestProcessMultipart(t *testing.T) { req := createUploadRequest(t, validOperations, validMap, files) var reqParams params - err := processMultipart(req, &reqParams, DefaultFileMaxMemory) + err := processMultipart(req, &reqParams, DefaultUploadMaxMemory) require.NotNil(t, err) require.Equal(t, err.Error(), "failed to get key 0 from form") }) @@ -362,7 +362,7 @@ func TestProcessMultipart(t *testing.T) { req := createUploadRequest(t, validOperations, mapData, validFiles) var reqParams params - err := processMultipart(req, &reqParams, DefaultFileMaxMemory) + err := processMultipart(req, &reqParams, DefaultUploadMaxMemory) require.NotNil(t, err) require.Equal(t, err.Error(), "invalid value for key 0") }) @@ -372,7 +372,7 @@ func TestProcessMultipart(t *testing.T) { req := createUploadRequest(t, validOperations, mapData, validFiles) var reqParams params - err := processMultipart(req, &reqParams, DefaultFileMaxMemory) + err := processMultipart(req, &reqParams, DefaultUploadMaxMemory) require.NotNil(t, err) require.Equal(t, err.Error(), "invalid value for key 0") }) @@ -381,7 +381,7 @@ func TestProcessMultipart(t *testing.T) { req := createUploadRequest(t, validOperations, validMap, validFiles) var reqParams params - err := processMultipart(req, &reqParams, DefaultFileMaxMemory) + err := processMultipart(req, &reqParams, DefaultUploadMaxMemory) require.Nil(t, err) require.Equal(t, "mutation ($file: Upload!) { singleUpload(file: $file) { id } }", reqParams.Query) require.Equal(t, "", reqParams.OperationName)