Documentation ¶
Index ¶
- func DefaultAPIList() map[string]libCallApi.RemoteApi
- func DefaultAccessRoles() map[string]string
- func DefaultDB(t *testing.T) *sql.DB
- func DefaultErrorDesc() map[string]string
- func GetAllSimulationHandler[Req any](core requestCore.RequestCoreInterface) gin.HandlerFunc
- func GetDMLModel(t *testing.T, m Model) libQuery.QueryRunnerModel
- func GetEnv[Env any, PT interface{ ... }](t *testing.T, defaultAPIList func() map[string]libCallApi.RemoteApi) PT
- func GetEnvWithDB[Env any, PT interface{ ... }](db *sql.DB, defaultAPIList func() map[string]libCallApi.RemoteApi) PT
- func GetRequestModel(t *testing.T) libQuery.QueryRunnerModel
- func GetSelectModel(t *testing.T, m Model) libQuery.QueryRunnerModel
- func GetSingleSimulationHandler[Req any](core requestCore.RequestCoreInterface) gin.HandlerFunc
- func InitSimulationHandler[Req any](c context.Context, core requestCore.RequestCoreInterface) (*Req, error)
- func InitTesting(t *testing.T, errDesc map[string]string, ...) (requestCore.RequestCoreModel, libParams.ParamInterface)
- func InitTestingNoDB(t *testing.T, errDesc map[string]string, ...) (requestCore.RequestCoreModel, libParams.ParamInterface)
- func PrepareEnvWithDB(env TestingEnv, db *sql.DB)
- func SampleMockDB(t *testing.T, mockList func(sqlmock.Sqlmock)) *sql.DB
- func SampleQueryMock(t *testing.T, mockList func(sqlmock.Sqlmock)) libQuery.QueryRunnerModel
- func SampleRequestModelMock(t *testing.T, mockList func(sqlmock.Sqlmock)) libQuery.QueryRunnerModel
- func TestAPI(t *testing.T, testCases []TestCase, options *TestOptions)
- func TestAPIList() map[string]libCallApi.RemoteApi
- func TestDB(t *testing.T, tc *TestCase, options *TestOptions)
- func TestDBFiber(t *testing.T, tc *TestCase, options *TestOptions)
- func TestDMLs[Model any, PT interface{ ... }](t *testing.T)
- func TestFetchData[Model any, PT interface{ ... }](t *testing.T, queryList map[string]libQuery.QueryCommand)
- type AnyString
- type CustomMockConverter
- type Header
- type KeyValuePair
- type Model
- type Params
- type TestCase
- type TestEnv
- type TestOptions
- type TestingEnv
- type TestingWsParams
- func (p *TestingWsParams) GetFonts() map[string]opentype.Font
- func (p *TestingWsParams) GetHeaderName() string
- func (p *TestingWsParams) GetImages() map[string]image.Image
- func (p *TestingWsParams) GetLogCompress() bool
- func (p *TestingWsParams) GetLogPath() string
- func (p *TestingWsParams) GetLogSize() int
- func (p *TestingWsParams) GetParams() map[string]string
- func (p *TestingWsParams) GetRoles() map[string]string
- func (p *TestingWsParams) GetSkipPaths() []string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultAPIList ¶
func DefaultAPIList() map[string]libCallApi.RemoteApi
func DefaultAccessRoles ¶
func DefaultErrorDesc ¶
func GetAllSimulationHandler ¶
func GetAllSimulationHandler[Req any](core requestCore.RequestCoreInterface) gin.HandlerFunc
func GetDMLModel ¶
func GetDMLModel(t *testing.T, m Model) libQuery.QueryRunnerModel
GetDMLModel handles INSERT, UPDATE, and DELETE in mock DB models.
func GetEnv ¶
func GetEnv[Env any, PT interface { GetInterface() requestCore.RequestCoreInterface GetParams() libParams.ParamInterface SetInterface(requestCore.RequestCoreInterface) SetParams(libParams.ParamInterface) *Env }](t *testing.T, defaultAPIList func() map[string]libCallApi.RemoteApi) PT
func GetEnvWithDB ¶
func GetEnvWithDB[Env any, PT interface { GetInterface() requestCore.RequestCoreInterface GetParams() libParams.ParamInterface SetInterface(requestCore.RequestCoreInterface) SetParams(libParams.ParamInterface) *Env }](db *sql.DB, defaultAPIList func() map[string]libCallApi.RemoteApi) PT
func GetRequestModel ¶ added in v0.9.47
func GetRequestModel(t *testing.T) libQuery.QueryRunnerModel
func GetSelectModel ¶
func GetSelectModel(t *testing.T, m Model) libQuery.QueryRunnerModel
GetSelectModel handles selecting a single or all items in mock DB model.
func GetSingleSimulationHandler ¶
func GetSingleSimulationHandler[Req any](core requestCore.RequestCoreInterface) gin.HandlerFunc
func InitSimulationHandler ¶
func InitSimulationHandler[Req any](c context.Context, core requestCore.RequestCoreInterface) (*Req, error)
func InitTesting ¶
func InitTesting(t *testing.T, errDesc map[string]string, remoteApis map[string]libCallApi.RemoteApi, query string, columns []string, csv string, module string, ) (requestCore.RequestCoreModel, libParams.ParamInterface)
columns are prefixed with "o" since we used sqlstruct to generate them
func InitTestingNoDB ¶
func InitTestingNoDB(t *testing.T, errDesc map[string]string, remoteApis map[string]libCallApi.RemoteApi, ) (requestCore.RequestCoreModel, libParams.ParamInterface)
func PrepareEnvWithDB ¶ added in v0.9.47
func PrepareEnvWithDB(env TestingEnv, db *sql.DB)
func SampleMockDB ¶ added in v0.10.2
func SampleQueryMock ¶ added in v0.9.20
func SampleQueryMock(t *testing.T, mockList func(sqlmock.Sqlmock)) libQuery.QueryRunnerModel
func SampleRequestModelMock ¶
func SampleRequestModelMock(t *testing.T, mockList func(sqlmock.Sqlmock)) libQuery.QueryRunnerModel
func TestAPI ¶
func TestAPI(t *testing.T, testCases []TestCase, options *TestOptions)
TestAPI tests a group of Api's test.
func TestAPIList ¶ added in v0.9.7
func TestAPIList() map[string]libCallApi.RemoteApi
func TestDB ¶
func TestDB(t *testing.T, tc *TestCase, options *TestOptions)
TestDB tests a single DB models.
func TestDBFiber ¶
func TestDBFiber(t *testing.T, tc *TestCase, options *TestOptions)
TestDB tests a single DB models.
func TestDMLs ¶
TestDMLs tests a model for equality of commands arguments, and given argumants, also it checks if given type is the same is the command.
func TestFetchData ¶
func TestFetchData[Model any, PT interface { libQuery.QueryRequest *Model }](t *testing.T, queryList map[string]libQuery.QueryCommand)
Types ¶
type CustomMockConverter ¶ added in v0.9.55
type CustomMockConverter struct{}
func (CustomMockConverter) ConvertValue ¶ added in v0.9.55
func (CustomMockConverter) ConvertValue(v interface{}) (driver.Value, error)
type Header ¶
type Header []KeyValuePair
type KeyValuePair ¶
type Params ¶ added in v0.9.47
type Params struct { Roles map[string]string Params map[string]string ErrorDesc map[string]string MessageDesc map[string]string AccessRoles map[string]string RemoteApis map[string]libCallApi.RemoteApi }
func InitTestingWithDB ¶
func InitTestingWithDB( errDesc map[string]string, remoteApis map[string]libCallApi.RemoteApi, db *sql.DB, ) (requestCore.RequestCoreModel, Params)
type TestEnv ¶
type TestEnv struct { Params libParams.ParamInterface Interface requestCore.RequestCoreInterface }
func (TestEnv) GetInterface ¶
func (env TestEnv) GetInterface() requestCore.RequestCoreInterface
func (TestEnv) GetParams ¶
func (env TestEnv) GetParams() libParams.ParamInterface
func (*TestEnv) SetInterface ¶
func (env *TestEnv) SetInterface(core requestCore.RequestCoreInterface)
func (*TestEnv) SetParams ¶
func (env *TestEnv) SetParams(params libParams.ParamInterface)
type TestOptions ¶
type TestingEnv ¶ added in v0.9.47
type TestingEnv interface { GetInterface() requestCore.RequestCoreInterface GetParams() libParams.ParamInterface SetInterface(requestCore.RequestCoreInterface) SetParams(libParams.ParamInterface) }
type TestingWsParams ¶
type TestingWsParams struct { RemoteApis map[string]libCallApi.RemoteApi `yaml:"remoteApis"` ErrorDesc map[string]string `yaml:"errorDesc"` MessageDesc map[string]string `yaml:"messageDesc"` AccessRoles map[string]string `yaml:"accessRoles"` }
func (*TestingWsParams) GetHeaderName ¶
func (p *TestingWsParams) GetHeaderName() string
func (*TestingWsParams) GetLogCompress ¶
func (p *TestingWsParams) GetLogCompress() bool
func (*TestingWsParams) GetLogPath ¶
func (p *TestingWsParams) GetLogPath() string
func (*TestingWsParams) GetLogSize ¶
func (p *TestingWsParams) GetLogSize() int
func (*TestingWsParams) GetParams ¶
func (p *TestingWsParams) GetParams() map[string]string
func (*TestingWsParams) GetRoles ¶
func (p *TestingWsParams) GetRoles() map[string]string
func (*TestingWsParams) GetSkipPaths ¶
func (p *TestingWsParams) GetSkipPaths() []string
Source Files ¶
Click to show internal directories.
Click to hide internal directories.