Documentation
¶
Index ¶
- func EmptyDB(db *sql.DB)
- func FeatureContext(s *godog.Suite)
- func InsertBatch(db *sql.DB, tableName string, data []map[string]interface{})
- func LoadFixture(db *sql.DB, fileName string)
- func MockDBTime(timeStrRaw string)
- func OpenRawDBConnection() (*sql.DB, error)
- func RestoreDBTime()
- func RunConcurrently(f func(), threadsNumber int)
- func RunGodogTests(t *testing.T)
- func SetupDBWithFixture(fixtureNames ...string) *database.DB
- func SetupDBWithFixtureString(fixtures ...string) *database.DB
- func ValidateJSONContentType(resp *http.Response) error
- type TestContext
- func (ctx *TestContext) DBGroupsAncestorsAreComputed() error
- func (ctx *TestContext) DBHasTable(tableName string, data *messages.PickleStepArgument_PickleTable) error
- func (ctx *TestContext) DBHasUsers(data *messages.PickleStepArgument_PickleTable) error
- func (ctx *TestContext) DbTimeNow(timeStrRaw string) error
- func (ctx *TestContext) IAmUserWithID(userID int64) error
- func (ctx *TestContext) ISendrequestTo(method string, path string) error
- func (ctx *TestContext) ISendrequestToWithBody(method string, path string, body *messages.PickleStepArgument_PickleDocString) error
- func (ctx *TestContext) ItShouldBeAJSONArrayWithEntries(count int) error
- func (ctx *TestContext) LogsShouldContain(docString *messages.PickleStepArgument_PickleDocString) error
- func (ctx *TestContext) ScenarioTeardown(*messages.Pickle, error)
- func (ctx *TestContext) SetupTestContext(pickle *messages.Pickle)
- func (ctx *TestContext) SignedTokenIsDistributed(varName, signerName string, ...) error
- func (ctx *TestContext) TableAtColumnValueShouldBe(tableName, columnName, columnValues string, ...) error
- func (ctx *TestContext) TableAtColumnValueShouldBeEmpty(tableName string, columnName, columnValues string) error
- func (ctx *TestContext) TableShouldBe(tableName string, data *messages.PickleStepArgument_PickleTable) error
- func (ctx *TestContext) TableShouldBeEmpty(tableName string) error
- func (ctx *TestContext) TableShouldNotContainColumnValue(tableName, columnName, columnValues string) error
- func (ctx *TestContext) TableShouldStayUnchanged(tableName string) error
- func (ctx *TestContext) TableShouldStayUnchangedButTheRowWithColumnValue(tableName, columnName, columnValues string) error
- func (ctx *TestContext) TheApplicationConfigIs(body *messages.PickleStepArgument_PickleDocString) error
- func (ctx *TestContext) TheContextVariableIs(variableName, value string) error
- func (ctx *TestContext) TheGeneratedAuthKeyIs(generatedString string) error
- func (ctx *TestContext) TheGeneratedAuthKeysAre(generatedStrings string) error
- func (ctx *TestContext) TheGeneratedGroupCodeIs(generatedCode string) error
- func (ctx *TestContext) TheGeneratedGroupCodesAre(generatedCodes string) error
- func (ctx *TestContext) TheLoginModuleAccountEndpointForTokenReturns(token string, statusCode int, ...) error
- func (ctx *TestContext) TheLoginModuleCreateEndpointWithParamsReturns(params string, statusCode int, ...) error
- func (ctx *TestContext) TheLoginModuleDeleteEndpointWithParamsReturns(params string, statusCode int, ...) error
- func (ctx *TestContext) TheLoginModuleLTIResultSendEndpointForUserIDContentIDScoreReturns(userID, contentID, score string, statusCode int, ...) error
- func (ctx *TestContext) TheLoginModuleTokenEndpointForCodeAndCodeVerifierAndRedirectURIReturns(code, codeVerifier, redirectURI string, statusCode int, ...) error
- func (ctx *TestContext) TheLoginModuleTokenEndpointForCodeAndCodeVerifierReturns(code, codeVerifier string, statusCode int, ...) error
- func (ctx *TestContext) TheLoginModuleTokenEndpointForCodeReturns(code string, statusCode int, body *messages.PickleStepArgument_PickleDocString) error
- func (ctx *TestContext) TheLoginModuleTokenEndpointForRefreshTokenReturns(refreshToken string, statusCode int, ...) error
- func (ctx *TestContext) TheLoginModuleUnlinkClientEndpointForUserIDReturns(userID string, statusCode int, ...) error
- func (ctx *TestContext) TheRequestHeaderIs(name, value string) error
- func (ctx *TestContext) TheResponseBodyShouldBe(body *messages.PickleStepArgument_PickleDocString) (err error)
- func (ctx *TestContext) TheResponseBodyShouldBeJSON(body *messages.PickleStepArgument_PickleDocString) (err error)
- func (ctx *TestContext) TheResponseCodeShouldBe(code int) error
- func (ctx *TestContext) TheResponseDecodedBodyShouldBeJSON(responseType string, body *messages.PickleStepArgument_PickleDocString) (err error)
- func (ctx *TestContext) TheResponseErrorMessageShouldContain(s string) (err error)
- func (ctx *TestContext) TheResponseHeaderShouldBe(headerName string, headerValue string) (err error)
- func (ctx *TestContext) TheResponseHeadersShouldBe(headerName string, headersValue *messages.PickleStepArgument_PickleDocString) (err error)
- func (ctx *TestContext) TheResponseShouldBe(kind string) error
- func (ctx *TestContext) TheTemplateConstantIsDocString(name string, value *messages.PickleStepArgument_PickleDocString) error
- func (ctx *TestContext) TheTemplateConstantIsString(name, value string) error
- func (ctx *TestContext) TimeIsFrozen() error
- func (ctx *TestContext) TimeNow(timeStr string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FeatureContext ¶
FeatureContext binds the supported steps to the verifying functions
func InsertBatch ¶
InsertBatch insert the data into the table with the name given
func LoadFixture ¶
LoadFixture loads fixtures from `<current_pkg_dir>/testdata/<fileName>/` directory or `<current_pkg_dir>/testdata/<fileName>` file. Each file in this directory must be in yaml format. If a file name satisfies '*.chain.yaml' mask, the file is treated as a tableName->[]dataRow map. Otherwise, data will be loaded into table with the same name as the filename (without extension). Note that you should probably empty the DB before using this function.
func MockDBTime ¶
func MockDBTime(timeStrRaw string)
MockDBTime replaces the DB NOW() function call with a given constant value in all the queries
func OpenRawDBConnection ¶
OpenRawDBConnection creates a new connection to the DB specified in the config
func RestoreDBTime ¶
func RestoreDBTime()
RestoreDBTime restores the usual behavior of the NOW() function
func RunConcurrently ¶
func RunConcurrently(f func(), threadsNumber int)
RunConcurrently runs a given function concurrently
func RunGodogTests ¶
RunGodogTests launches GoDog tests (bdd tests) for the current directory (the one from the tested package)
func SetupDBWithFixture ¶
SetupDBWithFixture creates a new DB connection, empties the DB, and loads a fixture
func SetupDBWithFixtureString ¶
SetupDBWithFixtureString creates a new DB connection, empties the DB, and loads fixtures from the strings (yaml with a tableName->[]dataRow map)
func ValidateJSONContentType ¶
ValidateJSONContentType validates the content-type header of the response is json If not, return an error
Types ¶
type TestContext ¶
type TestContext struct {
// contains filtered or unexported fields
}
TestContext implements context for tests
func (*TestContext) DBGroupsAncestorsAreComputed ¶
func (ctx *TestContext) DBGroupsAncestorsAreComputed() error
func (*TestContext) DBHasTable ¶
func (ctx *TestContext) DBHasTable(tableName string, data *messages.PickleStepArgument_PickleTable) error
func (*TestContext) DBHasUsers ¶
func (ctx *TestContext) DBHasUsers(data *messages.PickleStepArgument_PickleTable) error
func (*TestContext) DbTimeNow ¶
func (ctx *TestContext) DbTimeNow(timeStrRaw string) error
func (*TestContext) IAmUserWithID ¶
func (ctx *TestContext) IAmUserWithID(userID int64) error
func (*TestContext) ISendrequestTo ¶
func (ctx *TestContext) ISendrequestTo(method string, path string) error
func (*TestContext) ISendrequestToWithBody ¶
func (ctx *TestContext) ISendrequestToWithBody(method string, path string, body *messages.PickleStepArgument_PickleDocString) error
func (*TestContext) ItShouldBeAJSONArrayWithEntries ¶
func (ctx *TestContext) ItShouldBeAJSONArrayWithEntries(count int) error
func (*TestContext) LogsShouldContain ¶
func (ctx *TestContext) LogsShouldContain(docString *messages.PickleStepArgument_PickleDocString) error
func (*TestContext) ScenarioTeardown ¶
func (ctx *TestContext) ScenarioTeardown(*messages.Pickle, error)
func (*TestContext) SetupTestContext ¶
func (ctx *TestContext) SetupTestContext(pickle *messages.Pickle)
func (*TestContext) SignedTokenIsDistributed ¶
func (ctx *TestContext) SignedTokenIsDistributed(varName, signerName string, docString *messages.PickleStepArgument_PickleDocString) error
func (*TestContext) TableAtColumnValueShouldBe ¶
func (ctx *TestContext) TableAtColumnValueShouldBe(tableName, columnName, columnValues string, data *messages.PickleStepArgument_PickleTable) error
func (*TestContext) TableAtColumnValueShouldBeEmpty ¶
func (ctx *TestContext) TableAtColumnValueShouldBeEmpty(tableName string, columnName, columnValues string) error
func (*TestContext) TableShouldBe ¶
func (ctx *TestContext) TableShouldBe(tableName string, data *messages.PickleStepArgument_PickleTable) error
func (*TestContext) TableShouldBeEmpty ¶
func (ctx *TestContext) TableShouldBeEmpty(tableName string) error
func (*TestContext) TableShouldNotContainColumnValue ¶
func (ctx *TestContext) TableShouldNotContainColumnValue(tableName, columnName, columnValues string) error
func (*TestContext) TableShouldStayUnchanged ¶
func (ctx *TestContext) TableShouldStayUnchanged(tableName string) error
func (*TestContext) TableShouldStayUnchangedButTheRowWithColumnValue ¶
func (ctx *TestContext) TableShouldStayUnchangedButTheRowWithColumnValue(tableName, columnName, columnValues string) error
func (*TestContext) TheApplicationConfigIs ¶
func (ctx *TestContext) TheApplicationConfigIs(body *messages.PickleStepArgument_PickleDocString) error
func (*TestContext) TheContextVariableIs ¶
func (ctx *TestContext) TheContextVariableIs(variableName, value string) error
func (*TestContext) TheGeneratedAuthKeyIs ¶
func (ctx *TestContext) TheGeneratedAuthKeyIs(generatedString string) error
func (*TestContext) TheGeneratedAuthKeysAre ¶
func (ctx *TestContext) TheGeneratedAuthKeysAre(generatedStrings string) error
func (*TestContext) TheGeneratedGroupCodeIs ¶
func (ctx *TestContext) TheGeneratedGroupCodeIs(generatedCode string) error
func (*TestContext) TheGeneratedGroupCodesAre ¶
func (ctx *TestContext) TheGeneratedGroupCodesAre(generatedCodes string) error
func (*TestContext) TheLoginModuleAccountEndpointForTokenReturns ¶
func (ctx *TestContext) TheLoginModuleAccountEndpointForTokenReturns(token string, statusCode int, body *messages.PickleStepArgument_PickleDocString) error
func (*TestContext) TheLoginModuleCreateEndpointWithParamsReturns ¶
func (ctx *TestContext) TheLoginModuleCreateEndpointWithParamsReturns( params string, statusCode int, body *messages.PickleStepArgument_PickleDocString) error
func (*TestContext) TheLoginModuleDeleteEndpointWithParamsReturns ¶
func (ctx *TestContext) TheLoginModuleDeleteEndpointWithParamsReturns( params string, statusCode int, body *messages.PickleStepArgument_PickleDocString) error
func (*TestContext) TheLoginModuleLTIResultSendEndpointForUserIDContentIDScoreReturns ¶
func (ctx *TestContext) TheLoginModuleLTIResultSendEndpointForUserIDContentIDScoreReturns( userID, contentID, score string, statusCode int, body *messages.PickleStepArgument_PickleDocString) error
func (*TestContext) TheLoginModuleTokenEndpointForCodeAndCodeVerifierAndRedirectURIReturns ¶
func (ctx *TestContext) TheLoginModuleTokenEndpointForCodeAndCodeVerifierAndRedirectURIReturns(code, codeVerifier, redirectURI string, statusCode int, body *messages.PickleStepArgument_PickleDocString) error
func (*TestContext) TheLoginModuleTokenEndpointForCodeAndCodeVerifierReturns ¶
func (ctx *TestContext) TheLoginModuleTokenEndpointForCodeAndCodeVerifierReturns(code, codeVerifier string, statusCode int, body *messages.PickleStepArgument_PickleDocString) error
func (*TestContext) TheLoginModuleTokenEndpointForCodeReturns ¶
func (ctx *TestContext) TheLoginModuleTokenEndpointForCodeReturns(code string, statusCode int, body *messages.PickleStepArgument_PickleDocString) error
func (*TestContext) TheLoginModuleTokenEndpointForRefreshTokenReturns ¶
func (ctx *TestContext) TheLoginModuleTokenEndpointForRefreshTokenReturns(refreshToken string, statusCode int, body *messages.PickleStepArgument_PickleDocString) error
func (*TestContext) TheLoginModuleUnlinkClientEndpointForUserIDReturns ¶
func (ctx *TestContext) TheLoginModuleUnlinkClientEndpointForUserIDReturns( userID string, statusCode int, body *messages.PickleStepArgument_PickleDocString) error
func (*TestContext) TheRequestHeaderIs ¶
func (ctx *TestContext) TheRequestHeaderIs(name, value string) error
func (*TestContext) TheResponseBodyShouldBe ¶
func (ctx *TestContext) TheResponseBodyShouldBe(body *messages.PickleStepArgument_PickleDocString) (err error)
func (*TestContext) TheResponseBodyShouldBeJSON ¶
func (ctx *TestContext) TheResponseBodyShouldBeJSON(body *messages.PickleStepArgument_PickleDocString) (err error)
func (*TestContext) TheResponseCodeShouldBe ¶
func (ctx *TestContext) TheResponseCodeShouldBe(code int) error
func (*TestContext) TheResponseDecodedBodyShouldBeJSON ¶
func (ctx *TestContext) TheResponseDecodedBodyShouldBeJSON(responseType string, body *messages.PickleStepArgument_PickleDocString) (err error)
func (*TestContext) TheResponseErrorMessageShouldContain ¶
func (ctx *TestContext) TheResponseErrorMessageShouldContain(s string) (err error)
func (*TestContext) TheResponseHeaderShouldBe ¶
func (ctx *TestContext) TheResponseHeaderShouldBe(headerName string, headerValue string) (err error)
func (*TestContext) TheResponseHeadersShouldBe ¶
func (ctx *TestContext) TheResponseHeadersShouldBe(headerName string, headersValue *messages.PickleStepArgument_PickleDocString) (err error)
func (*TestContext) TheResponseShouldBe ¶
func (ctx *TestContext) TheResponseShouldBe(kind string) error
func (*TestContext) TheTemplateConstantIsDocString ¶
func (ctx *TestContext) TheTemplateConstantIsDocString(name string, value *messages.PickleStepArgument_PickleDocString) error
func (*TestContext) TheTemplateConstantIsString ¶
func (ctx *TestContext) TheTemplateConstantIsString(name, value string) error
func (*TestContext) TimeIsFrozen ¶
func (ctx *TestContext) TimeIsFrozen() error
func (*TestContext) TimeNow ¶
func (ctx *TestContext) TimeNow(timeStr string) error