Feature: integration testing

Add integration tests with testify/suite. Moved some structs
outside of controller funcs so we can re-use them in the testing
package. Add CI workflow for running tests on every push.
This commit is contained in:
kiwiidb
2022-02-01 11:47:11 +01:00
parent 89a924bd30
commit 1ae5df6b8c
6 changed files with 178 additions and 29 deletions

View File

@@ -16,6 +16,11 @@ func NewCreateUserController(svc *service.LndhubService) *CreateUserController {
return &CreateUserController{svc: svc}
}
type CreateUserResponseBody struct {
Login string `json:"login"`
Password string `json:"password"`
}
// CreateUser : Create user Controller
func (controller *CreateUserController) CreateUser(c echo.Context) error {
// optional parameters that we currently do not use
@@ -34,10 +39,7 @@ func (controller *CreateUserController) CreateUser(c echo.Context) error {
return err
}
var ResponseBody struct {
Login string `json:"login"`
Password string `json:"password"`
}
var ResponseBody CreateUserResponseBody
ResponseBody.Login = user.Login
ResponseBody.Password = user.Password