modulepackage
0.0.0-20201124071338-dc6336485b43
Repository: https://github.com/gaoey/stubby.git
Documentation: pkg.go.dev
# README
Golang Stubby
easily stub services, and scenarios service for integration testing.
feature - stub service - scenario
Stub server usage
- create const at
./stub/const.go
var (
EXAMPLE = "EXAMPLE"
)
var Routes = map[string]string{
EXAMPLE: "/path/v1/:id",
}
var MapStub = map[string][]Stubby{
EXAMPLE: ExampleStub,
}
- create stub file in
./stub
such as example.go
var ExampleStub = []Stubby{
Stubby{
ID: "example-1",
Name: EXAMPLE,
Description: "DEPOSIT - Response Success",
Validate: func(c echo.Context) bool {
return true
},
Request: Request{
URL: Routes[EXAMPLE],
Method: http.MethodGet,
Body: ".*",
},
Response: Response{
Status: 200,
Header: map[string]string{
echo.HeaderContentType: echo.MIMEApplicationJSON,
},
Body: "{\"test\":{\"payload\": 2}}",
},
}
}
Scenario server usage
- ???
# Functions
No description provided by the author