MCPcopy Create free account
hub / github.com/UiPath/uipathcli / TestPostFormRequestWithLargeFile

Function TestPostFormRequestWithLargeFile

test/execution_test.go:1069–1096  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1067}
1068
1069func TestPostFormRequestWithLargeFile(t *testing.T) {
1070 definition := `
1071paths:
1072 /validate:
1073 post:
1074 requestBody:
1075 content:
1076 multipart/form-data:
1077 schema:
1078 properties:
1079 file:
1080 type: string
1081 format: binary
1082 description: The file to upload
1083`
1084 context := NewContextBuilder().
1085 WithResponse(http.StatusOK, "{}").
1086 WithDefinition("myservice", definition).
1087 Build()
1088
1089 path := CreateTempFileBinary(t, make([]byte, 10*1024*1024))
1090
1091 result := RunCli([]string{"myservice", "post-validate", "--file", path}, context)
1092
1093 if len(result.RequestBody) < 10*1024*1024 {
1094 t.Errorf("Request body does not contain large file, got only %v bytes", len(result.RequestBody))
1095 }
1096}
1097
1098func TestPostRequestWithDefaultValueWhenRequired(t *testing.T) {
1099 definition := `

Callers

nothing calls this directly

Calls 6

NewContextBuilderFunction · 0.85
CreateTempFileBinaryFunction · 0.85
RunCliFunction · 0.85
WithDefinitionMethod · 0.80
WithResponseMethod · 0.80
BuildMethod · 0.45

Tested by

no test coverage detected