v0.1.10
New
- Support
multipart/form-data
#31
func TestUploadfile(t *testing.T) {
cute.NewTestBuilder().
Title("Uploat file").
Create().
RequestBuilder(
cute.WithURI("http://localhost:7000/v1/admin/banner"),
cute.WithMethod("POST"),
cute.WithFormKV("body", []byte("{\"age\": 42}")),
cute.WithFileFormKV("image", &cute.File{
Path: "/vasya/gogogo.png",
}),
).
ExecuteTest(context.Background(), t)
}
- Implement hard validation
#30
func TestUploadfile(t *testing.T) {
cute.NewTestBuilder().
Title("Uploat file").
Create().
RequestBuilder(
cute.WithURI("http://localhost:7000/v1/admin/banner"),
cute.WithMethod("POST"),
cute.WithFormKV("body", []byte("{\"age\": 42}")),
cute.WithFileFormKV("image", &cute.File{
Path: "/vasya/gogogo.png",
}),
).
EnableHardValidation(). <- enable hard validation
ExpectStatus(http.StatusOK).
ExecuteTest(context.Background(), t)
}
- Rename asserts
GreaterThan => LengthGreaterThan
GreaterOrEqualThan => LengthGreaterOrEqualThan
LessThan => LengthLessThan
LessOrEqualThan => LengthLessOrEqualThan
- Implement common after/before test
#32
func TestName(t *testing.T) {
testMaker := cute.NewHTTPTestMaker(
cute.WithMiddlewareAfterT(modules.LogTraceID),
)
}
func LogTraceID(t cute.T, response *http.Response, errors []error) error {
t.Logf("[o3_request_info] Trace_id - %v", response.Header.Get("x-trace-id"))
return nil
}
- Remove deprecated method
CreateWithStep().
StepName("Step name").
you have to replace it by
CreateStep("Step name").