(t *testing.T)
| 1067 | } |
| 1068 | |
| 1069 | func TestPostFormRequestWithLargeFile(t *testing.T) { |
| 1070 | definition := ` |
| 1071 | paths: |
| 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 | |
| 1098 | func TestPostRequestWithDefaultValueWhenRequired(t *testing.T) { |
| 1099 | definition := ` |
nothing calls this directly
no test coverage detected