Documentation
¶
Index ¶
- Variables
- func AssetsFilePath(testDir string, fileName string) string
- func BBGinEngine(t *testing.T, server bare_bones_server.Server) *gin.Engine
- func BBRestApiServer(t *testing.T, server bare_bones_server.Server) *rest_api_gin_server.Server
- func CheckDuplicateKeyError(provider string, result *gorm.DB) (bool, error)
- func CheckGenericError(t *testing.T, err error, expectedCode string, expectedMessage ...string)
- func CheckGenericErrorTaxonomy(t *testing.T, err error, expectedCode string, expectedFamily string, ...)
- func CheckResponse(t *testing.T, resp *HttpResponse, expected *Expected)
- func CreateDatabase(t *testing.T, dbConfig *PostgresDbConfig, dbName string)
- func CreateDbModel(t *testing.T, app app_context.Context, models ...interface{})
- func CreateDbModels(t *testing.T, app app_context.Context, models []interface{})
- func DbCreator(provider string, db *gorm.DB, dbName string) error
- func DbDsnBuilder(t *testing.T, config *db.DBConfig) (string, error)
- func DbGormOpener(provider string, dsn string) (gorm.Dialector, error)
- func DefaultAppBuilder(t *testing.T, buildConfig *app_context.BuildConfig) app_context.Context
- func DefaultAppInitializer(t *testing.T, app app_context.Context, configFile string, args []string, ...) error
- func DropDatabase(t *testing.T, dbConfig *PostgresDbConfig, dbName string)
- func DumpError(t *testing.T, err error, message ...string)
- func DumpObject(t *testing.T, obj interface{}, message ...string)
- func ExternalConfigFileExists(path string) bool
- func ExternalConfigFilePath(path string) string
- func HttpDelete(t *testing.T, g *gin.Engine, path string, cmd interface{}, ...) (*httptest.ResponseRecorder, int, string)
- func HttpGet(t *testing.T, g *gin.Engine, path string, cmd interface{}, ...) (*httptest.ResponseRecorder, int, string)
- func HttpHeadersSet(req *http.Request, headers ...map[string]string)
- func HttpPatch(t *testing.T, g *gin.Engine, path string, cmd interface{}, ...) (*httptest.ResponseRecorder, int, string)
- func HttpPost(t *testing.T, g *gin.Engine, path string, cmd interface{}, ...) (*httptest.ResponseRecorder, int, string)
- func HttpPut(t *testing.T, g *gin.Engine, path string, cmd interface{}, ...) (*httptest.ResponseRecorder, int, string)
- func HttpRequestBody(t *testing.T, g *gin.Engine, method string, path string, cmd interface{}, ...) (*httptest.ResponseRecorder, int, string)
- func HttpRequestQuery(t *testing.T, g *gin.Engine, method string, path string, args interface{}, ...) (*httptest.ResponseRecorder, int, string)
- func HttpRequestSend(t *testing.T, g *gin.Engine, req *http.Request) (*httptest.ResponseRecorder, int, string)
- func InitAppContext(t *testing.T, testDir string, dbModels []interface{}, config string, ...) (app_context.Context, context.Context)
- func InitAppContextNoDb(t *testing.T, testDir string, config ...string) app_context.Context
- func InitDbModels(t *testing.T, testDir string, dbModels []interface{}, config ...string)
- func InitDefaultAppContextNoDb(t *testing.T, testDir string, config ...string) (app_context.Context, context.Context)
- func IsTesting() bool
- func MultitenancyOpContext(app app_context.Context, name string) (multitenancy.TenancyContext, context.Context)
- func NoError(t *testing.T, sctx context.Context, err error)
- func NoErrorApp(t *testing.T, app app_context.Context, err error)
- func ObjectEqual(t *testing.T, left common.Object, right common.Object)
- func PartitionedMonthMigrator(provider string, sctx context.Context, db *gorm.DB, models ...interface{}) error
- func ResponseErrorCode(t *testing.T, resp *HttpResponse) string
- func RestApiTestClient(t *testing.T, g *gin.Engine, baseUrl string, userAgent ...string) *rest_api_client.RestApiClientBase
- func SetAppHandlers(builder AppBuilder, initializer AppInitializer)
- func SetTesting(t *testing.T)
- func SetupGormDB(t *testing.T)
- func SimpleOpContext(app app_context.Context, name string) (op_context.Context, context.Context)
- func SqliteDatabasesPath() string
- func SqliteDbPath(fileName string) string
- func SqlitePath(config *db.DBConfig) string
- func UserOpContext(app app_context.Context, name string, user auth.User, ...) (auth.UserContext, context.Context)
- type AppBuilder
- type AppInitializer
- type Expected
- type HttpClient
- func (c *HttpClient) Delete(path string, cmd interface{}, headers ...map[string]string) *HttpResponse
- func (c *HttpClient) Get(path string, cmd interface{}, headers ...map[string]string) *HttpResponse
- func (c *HttpClient) Login(user string, password string, expectedErrorCode ...string)
- func (c *HttpClient) Logout()
- func (c *HttpClient) Patch(path string, cmd interface{}, headers ...map[string]string) *HttpResponse
- func (c *HttpClient) Post(path string, cmd interface{}, headers ...map[string]string) *HttpResponse
- func (c *HttpClient) PostSigned(t *testing.T, signer *crypt_utils.RsaSigner, path string, cmd interface{}, ...) *HttpResponse
- func (c *HttpClient) Prepare()
- func (c *HttpClient) Put(t *testing.T, path string, cmd interface{}, headers ...map[string]string) *HttpResponse
- func (c *HttpClient) RequestBody(method string, path string, cmd interface{}, headers ...map[string]string) *HttpResponse
- func (c *HttpClient) RequestQuery(method string, path string, cmd interface{}, headers ...map[string]string) *HttpResponse
- func (c *HttpClient) RequestRefreshToken(expectedErrorCode ...string)
- func (c *HttpClient) SendSmsConfirmation(resp *HttpResponse, code string, method string, path string, cmd interface{}, ...) *HttpResponse
- func (c *HttpClient) SendSmsConfirmationWithToken(resp *HttpResponse, token string, code string, method string, path string, ...) *HttpResponse
- func (c *HttpClient) Sleep(seconds int, message string)
- func (c *HttpClient) UpdateCsrfToken()
- func (c *HttpClient) UpdateTokens()
- func (c *HttpClient) Url(path string) string
- type HttpResponse
- type PostgresDbConfig
- type RestApiTestResponse
- func HttptestSendWithBody(t *testing.T, g *gin.Engine, method string, url string, cmd interface{}, ...) *RestApiTestResponse
- func HttptestSendWithQuery(t *testing.T, g *gin.Engine, method string, url string, cmd interface{}, ...) *RestApiTestResponse
- func NewRestApiTestResponse(raw *httptest.ResponseRecorder) (*RestApiTestResponse, error)
- func (r *RestApiTestResponse) Body() []byte
- func (r *RestApiTestResponse) Code() int
- func (r *RestApiTestResponse) Error() generic_error.Error
- func (r *RestApiTestResponse) GetHeader(key string) string
- func (r *RestApiTestResponse) Header() http.Header
- func (r *RestApiTestResponse) Message() string
- func (r *RestApiTestResponse) SetError(err generic_error.Error)
- func (r *RestApiTestResponse) SetHeader(key string, value string)
Constants ¶
This section is empty.
Variables ¶
View Source
var ExternalConfigPath = ""
View Source
var Phone = ""
View Source
var SqliteFolder string = ""
View Source
var Testing = ""
Functions ¶
func AssetsFilePath ¶
func BBGinEngine ¶
func BBRestApiServer ¶
func BBRestApiServer(t *testing.T, server bare_bones_server.Server) *rest_api_gin_server.Server
func CheckDuplicateKeyError ¶
func CheckGenericError ¶
func CheckGenericErrorTaxonomy ¶
func CheckGenericErrorTaxonomy(t *testing.T, err error, expectedCode string, expectedFamily string, expectedDisposition generic_error.Disposition)
CheckGenericErrorTaxonomy asserts the family/disposition half of the error contract in whitemdesktop/docs/error-contract.md, on top of CheckGenericError's code/message check - i.e. that the code was registered with the family it claims to belong to and derives (or was explicitly overridden to) the expected disposition, not just that its bare code string matches.
func CheckResponse ¶
func CheckResponse(t *testing.T, resp *HttpResponse, expected *Expected)
func CreateDatabase ¶
func CreateDatabase(t *testing.T, dbConfig *PostgresDbConfig, dbName string)
func CreateDbModel ¶
func CreateDbModel(t *testing.T, app app_context.Context, models ...interface{})
func CreateDbModels ¶
func CreateDbModels(t *testing.T, app app_context.Context, models []interface{})
func DefaultAppBuilder ¶
func DefaultAppBuilder(t *testing.T, buildConfig *app_context.BuildConfig) app_context.Context
func DefaultAppInitializer ¶
func DropDatabase ¶
func DropDatabase(t *testing.T, dbConfig *PostgresDbConfig, dbName string)
func DumpObject ¶
func ExternalConfigFilePath ¶
func HttpDelete ¶
func HttpRequestBody ¶
func HttpRequestQuery ¶
func HttpRequestSend ¶
func InitAppContext ¶
func InitAppContextNoDb ¶
func InitDbModels ¶
func MultitenancyOpContext ¶
func MultitenancyOpContext(app app_context.Context, name string) (multitenancy.TenancyContext, context.Context)
func NoErrorApp ¶
func NoErrorApp(t *testing.T, app app_context.Context, err error)
func ResponseErrorCode ¶
func ResponseErrorCode(t *testing.T, resp *HttpResponse) string
func RestApiTestClient ¶
func RestApiTestClient(t *testing.T, g *gin.Engine, baseUrl string, userAgent ...string) *rest_api_client.RestApiClientBase
func SetAppHandlers ¶
func SetAppHandlers(builder AppBuilder, initializer AppInitializer)
func SetTesting ¶
func SetupGormDB ¶
func SimpleOpContext ¶
func SimpleOpContext(app app_context.Context, name string) (op_context.Context, context.Context)
func SqliteDatabasesPath ¶
func SqliteDatabasesPath() string
func SqliteDbPath ¶
func SqlitePath ¶
func UserOpContext ¶
func UserOpContext(app app_context.Context, name string, user auth.User, tenancy ...multitenancy.Tenancy) (auth.UserContext, context.Context)
Types ¶
type AppBuilder ¶
type AppBuilder = func(t *testing.T, buildConfig *app_context.BuildConfig) app_context.Context
type AppInitializer ¶
type HttpClient ¶
type HttpClient struct {
BaseUrl string
AccessToken string
RefreshToken string
CsrfToken string
Gin *gin.Engine
AutoSms bool
T *testing.T
}
func NewHttpClient ¶
func PrepareHttpClient ¶
func (*HttpClient) Delete ¶
func (c *HttpClient) Delete(path string, cmd interface{}, headers ...map[string]string) *HttpResponse
func (*HttpClient) Get ¶
func (c *HttpClient) Get(path string, cmd interface{}, headers ...map[string]string) *HttpResponse
func (*HttpClient) Login ¶
func (c *HttpClient) Login(user string, password string, expectedErrorCode ...string)
func (*HttpClient) Logout ¶
func (c *HttpClient) Logout()
func (*HttpClient) Patch ¶
func (c *HttpClient) Patch(path string, cmd interface{}, headers ...map[string]string) *HttpResponse
func (*HttpClient) Post ¶
func (c *HttpClient) Post(path string, cmd interface{}, headers ...map[string]string) *HttpResponse
func (*HttpClient) PostSigned ¶
func (c *HttpClient) PostSigned(t *testing.T, signer *crypt_utils.RsaSigner, path string, cmd interface{}, headers ...map[string]string) *HttpResponse
func (*HttpClient) Prepare ¶
func (c *HttpClient) Prepare()
func (*HttpClient) Put ¶
func (c *HttpClient) Put(t *testing.T, path string, cmd interface{}, headers ...map[string]string) *HttpResponse
func (*HttpClient) RequestBody ¶
func (c *HttpClient) RequestBody(method string, path string, cmd interface{}, headers ...map[string]string) *HttpResponse
func (*HttpClient) RequestQuery ¶
func (c *HttpClient) RequestQuery(method string, path string, cmd interface{}, headers ...map[string]string) *HttpResponse
func (*HttpClient) RequestRefreshToken ¶
func (c *HttpClient) RequestRefreshToken(expectedErrorCode ...string)
func (*HttpClient) SendSmsConfirmation ¶
func (c *HttpClient) SendSmsConfirmation(resp *HttpResponse, code string, method string, path string, cmd interface{}, headers ...map[string]string) *HttpResponse
func (*HttpClient) SendSmsConfirmationWithToken ¶
func (c *HttpClient) SendSmsConfirmationWithToken(resp *HttpResponse, token string, code string, method string, path string, cmd interface{}, headers ...map[string]string) *HttpResponse
func (*HttpClient) Sleep ¶
func (c *HttpClient) Sleep(seconds int, message string)
func (*HttpClient) UpdateCsrfToken ¶
func (c *HttpClient) UpdateCsrfToken()
func (*HttpClient) UpdateTokens ¶
func (c *HttpClient) UpdateTokens()
func (*HttpClient) Url ¶
func (c *HttpClient) Url(path string) string
type HttpResponse ¶
type HttpResponse struct {
Object *httptest.ResponseRecorder
Code int
Message string
}
type PostgresDbConfig ¶
type PostgresDbConfig struct {
DbHost string
DbPort uint16
DbUser string
DbPassword string
DbNameForLogin string
DbName string
}
func NewPostgresDbConfig ¶
func NewPostgresDbConfig() *PostgresDbConfig
func (*PostgresDbConfig) Url ¶
func (p *PostgresDbConfig) Url() string
type RestApiTestResponse ¶
type RestApiTestResponse struct {
Raw *httptest.ResponseRecorder
// contains filtered or unexported fields
}
func HttptestSendWithBody ¶
func HttptestSendWithQuery ¶
func NewRestApiTestResponse ¶
func NewRestApiTestResponse(raw *httptest.ResponseRecorder) (*RestApiTestResponse, error)
func (*RestApiTestResponse) Body ¶
func (r *RestApiTestResponse) Body() []byte
func (*RestApiTestResponse) Code ¶
func (r *RestApiTestResponse) Code() int
func (*RestApiTestResponse) Error ¶
func (r *RestApiTestResponse) Error() generic_error.Error
func (*RestApiTestResponse) GetHeader ¶
func (r *RestApiTestResponse) GetHeader(key string) string
func (*RestApiTestResponse) Header ¶
func (r *RestApiTestResponse) Header() http.Header
func (*RestApiTestResponse) Message ¶
func (r *RestApiTestResponse) Message() string
func (*RestApiTestResponse) SetError ¶
func (r *RestApiTestResponse) SetError(err generic_error.Error)
func (*RestApiTestResponse) SetHeader ¶
func (r *RestApiTestResponse) SetHeader(key string, value string)
Click to show internal directories.
Click to hide internal directories.