Skip to content

Commit

Permalink
Fix tests. Improve code format.
Browse files Browse the repository at this point in the history
  • Loading branch information
hantonelli committed Mar 31, 2019
1 parent 425849a commit 83cde4b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion codegen/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
1 change: 0 additions & 1 deletion handler/graphql.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
14 changes: 7 additions & 7 deletions handler/graphql_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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")
})
Expand All @@ -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")
})
Expand All @@ -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")
})
Expand All @@ -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")
})
Expand All @@ -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")
})
Expand All @@ -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)
Expand Down

0 comments on commit 83cde4b

Please sign in to comment.