testhelpers

package
v2.22.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 19, 2024 License: MIT Imports: 57 Imported by: 0

Documentation

Overview

Package testhelpers provides the interface and features to run the Gherkin tests.

Index

Constants

View Source
const (
	// PropagationStepSanityCheck is a fake propagation step which is called by PropagationVerifier
	// before triggering propagations in order to check that the hook is working without errors.
	PropagationStepSanityCheck database.PropagationStep = "sanity check"
	// PropagationStepAfterAllPropagations is a fake propagation step which is called by PropagationVerifier after all propagations.
	PropagationStepAfterAllPropagations database.PropagationStep = "after all propagations"
)

Variables

This section is empty.

Functions

func BindGodogCmdFlags

func BindGodogCmdFlags()

BindGodogCmdFlags binds the command arguments into the Godog options.

func EmptyDB

func EmptyDB(db *sql.DB)

EmptyDB empties all tables of the database specified in the config.

func InitializeScenario

func InitializeScenario(s *godog.ScenarioContext)

InitializeScenario binds the supported steps to the verifying functions.

func InsertBatch

func InsertBatch(db *sql.DB, tableName string, data []map[string]interface{})

InsertBatch insert the data into the table with the name given.

func LoadFixture

func LoadFixture(db *sql.DB, fileName string)

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

func OpenRawDBConnection() (*sql.DB, error)

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

func RunGodogTests(t *testing.T, tags string)

RunGodogTests launches GoDog tests (bdd tests) for the current directory (the one from the tested package).

func SendTestHTTPRequest added in v2.21.4

func SendTestHTTPRequest(ts *httptest.Server, method, path string, headers map[string][]string, body io.Reader) (
	response *http.Response, responseBody string, err error,
)

SendTestHTTPRequest sends an HTTP request to a given path on the test server. It returns the response and the response body as a string. The response body is read completely and closed. The timeout for requests is set to 5 seconds.

func SetupDBWithFixture

func SetupDBWithFixture(fixtureNames ...string) *database.DB

SetupDBWithFixture creates a new DB connection, empties the DB, and loads a fixture.

func SetupDBWithFixtureString

func SetupDBWithFixtureString(fixtures ...string) *database.DB

SetupDBWithFixtureString creates a new DB connection, empties the DB, and loads fixtures from the strings (yaml with a tableName->[]dataRow map).

func SuppressOutputIfPasses

func SuppressOutputIfPasses(t *testing.T)

SuppressOutputIfPasses immediately mutes output (to both STDOUT and STDERR) of the test so that the output will only be shown if the test fails. The cleanup part is scheduled to be run automatically, no need to clean up manually.

Note: This function will only work when the test is not run in parallel within the test binary, i.e. when the test (or its parents) haven't called t.Parallel(), otherwise it will panic. After the output is suppressed, t.Parallel() for the test will panic.

Note: This function does nothing if the test is run in verbose mode.

func ValidateJSONContentType

func ValidateJSONContentType(resp *http.Response) error

ValidateJSONContentType validates the content-type header of the response is json If not, return an error.

func VerifyTestHTTPRequestWithToken added in v2.21.4

func VerifyTestHTTPRequestWithToken(t *testing.T, hookedAppServer *httptest.Server,
	token string, expectedStatusCode int,
	method string, path string, headers map[string][]string, body interface{},
)

VerifyTestHTTPRequestWithToken makes an HTTP request to the given path on the test server with the given token and verifies that the response status code is as expected. Note, that the request is made with a 5-second timeout.

Types

type PropagationStepsSet added in v2.21.4

type PropagationStepsSet = golang.Set[database.PropagationStep]

PropagationStepsSet is a set of propagation steps.

type PropagationVerifier added in v2.21.4

type PropagationVerifier struct {
	// contains filtered or unexported fields
}

PropagationVerifier is a helper to test the propagation steps. It allows to run the code that triggers propagations and the code that should be executed before and after each propagation step. It also allows to check that the required propagation steps were called. Also, the propagation verifier detects infinite loops in the propagation steps by limiting the number of calls to each step.

func NewPropagationVerifier added in v2.21.4

func NewPropagationVerifier(requiredPropagationSteps *PropagationStepsSet) *PropagationVerifier

NewPropagationVerifier creates a new PropagationVerifier with the required propagation steps.

func (*PropagationVerifier) Run added in v2.21.4

func (pv *PropagationVerifier) Run(
	t *testing.T,
	codeTriggeringPropagations func(dataStore *database.DataStore, appServer *httptest.Server),
)

Run runs the propagation verifier.

func (*PropagationVerifier) WithFixture added in v2.21.4

func (pv *PropagationVerifier) WithFixture(fixture string) *PropagationVerifier

WithFixture sets the DB fixture to load before running the verification.

func (*PropagationVerifier) WithHook added in v2.21.4

WithHook sets the hook function that will be called before each propagation step and before and after all propagations.

type PropagationVerifierHookFunc added in v2.21.4

type PropagationVerifierHookFunc func(step database.PropagationStep, allStepsCounter, currentStepCounter int,
	dataStore *database.DataStore, appServer *httptest.Server)

PropagationVerifierHookFunc is a function that is called by PropagationVerifier before each propagation step and before and after all propagations.

type TestContext

type TestContext struct {
	// contains filtered or unexported fields
}

TestContext implements context for tests.

func (*TestContext) AllUsersGroupIsDefinedAsTheGroup

func (ctx *TestContext) AllUsersGroupIsDefinedAsTheGroup(group string) error

AllUsersGroupIsDefinedAsTheGroup creates and sets the allUsersGroup.

func (*TestContext) DBGroupsAncestorsAreComputed

func (ctx *TestContext) DBGroupsAncestorsAreComputed() error

DBGroupsAncestorsAreComputed computes the groups_ancestors table.

func (*TestContext) DBHasTable

func (ctx *TestContext) DBHasTable(tableName string, data *godog.Table) error

DBHasTable inserts the data from the Godog table into the database table.

func (*TestContext) DBHasUsers

func (ctx *TestContext) DBHasUsers(data *godog.Table) error

DBHasUsers inserts the data from the Godog table into the users and groups tables.

func (*TestContext) DBItemsAncestorsAndPermissionsAreComputed

func (ctx *TestContext) DBItemsAncestorsAndPermissionsAreComputed() error

DBItemsAncestorsAndPermissionsAreComputed computes the items_ancestors and permissions_generated tables.

func (*TestContext) DBTimeNow added in v2.21.4

func (ctx *TestContext) DBTimeNow(timeStrRaw string) error

DBTimeNow sets the current time in the database to the provided time.

func (*TestContext) FalsifiedSignedTokenIsDistributed

func (ctx *TestContext) FalsifiedSignedTokenIsDistributed(
	varName, signerName string,
	jsonPayload *godog.DocString,
) error

FalsifiedSignedTokenIsDistributed generates a falsified token and sets it in a global template variable.

func (*TestContext) GroupIsAChildOfTheGroup

func (ctx *TestContext) GroupIsAChildOfTheGroup(childGroup, parentGroup string) error

GroupIsAChildOfTheGroup puts a group as a child of another group.

func (*TestContext) IAm

func (ctx *TestContext) IAm(name string) error

IAm Sets the current user.

func (*TestContext) IAmAManagerOfTheGroup

func (ctx *TestContext) IAmAManagerOfTheGroup(group string) error

IAmAManagerOfTheGroup sets the user as a manager of a group with an id.

func (*TestContext) IAmAManagerOfTheGroupAndCanWatchItsMembers

func (ctx *TestContext) IAmAManagerOfTheGroupAndCanWatchItsMembers(group string) error

IAmAManagerOfTheGroupAndCanWatchItsMembers sets the user as a manager of a group with can_watch permission.

func (*TestContext) IAmAManagerOfTheGroupWithID

func (ctx *TestContext) IAmAManagerOfTheGroupWithID(group string) error

IAmAManagerOfTheGroupWithID sets the user as a manager of a group with an id.

func (*TestContext) IAmAMemberOfTheGroup

func (ctx *TestContext) IAmAMemberOfTheGroup(name string) error

IAmAMemberOfTheGroup puts a user in a group.

func (*TestContext) IAmAMemberOfTheGroupWithID

func (ctx *TestContext) IAmAMemberOfTheGroupWithID(group string) error

IAmAMemberOfTheGroupWithID creates a group and add the user in it.

func (*TestContext) IAmPartOfTheHelperGroupOfTheThread

func (ctx *TestContext) IAmPartOfTheHelperGroupOfTheThread() error

IAmPartOfTheHelperGroupOfTheThread states that user is a member of the helper group, of a given thread.

func (*TestContext) IAmUserWithID

func (ctx *TestContext) IAmUserWithID(userID int64) error

IAmUserWithID sets the current logged user to the one with the provided ID.

func (*TestContext) ICanOnItemWithID

func (ctx *TestContext) ICanOnItemWithID(watchType, watchValue, item string) error

ICanOnItemWithID gives the user a permission on an item.

func (*TestContext) ICanRequestHelpToTheGroupWithIDOnTheItemWithID

func (ctx *TestContext) ICanRequestHelpToTheGroupWithIDOnTheItemWithID(group, item string) error

ICanRequestHelpToTheGroupWithIDOnTheItemWithID gives the user the permission to request help from a given group to a given item.

func (*TestContext) ICanViewOnItemWithID

func (ctx *TestContext) ICanViewOnItemWithID(viewValue, item string) error

ICanViewOnItemWithID gives the user a "view" permission on an item.

func (*TestContext) ICanWatchGroup

func (ctx *TestContext) ICanWatchGroup(groupName string) error

ICanWatchGroup adds the permission for the user to watch a group.

func (*TestContext) ICanWatchGroupWithID

func (ctx *TestContext) ICanWatchGroupWithID(group string) error

ICanWatchGroupWithID adds the permission for the user to watch a group.

func (*TestContext) ICanWatchOnItemWithID

func (ctx *TestContext) ICanWatchOnItemWithID(watchValue, item string) error

ICanWatchOnItemWithID gives the user a "watch" permission on an item.

func (*TestContext) IHaveValidatedItemWithID

func (ctx *TestContext) IHaveValidatedItemWithID(item string) error

IHaveValidatedItemWithID states that user has validated an item.

func (*TestContext) ISendrequestTo

func (ctx *TestContext) ISendrequestTo(method string, path string) error

func (*TestContext) ISendrequestToWithBody

func (ctx *TestContext) ISendrequestToWithBody(method string, path string, body *godog.DocString) error

func (*TestContext) IsAMemberOfTheGroup

func (ctx *TestContext) IsAMemberOfTheGroup(childGroupName, parentGroupName string)

IsAMemberOfTheGroup Puts a group in a group.

func (*TestContext) ItShouldBeAJSONArrayWithEntries

func (ctx *TestContext) ItShouldBeAJSONArrayWithEntries(count int) error

func (*TestContext) ItemRelationSetPropagation

func (ctx *TestContext) ItemRelationSetPropagation(propagation, value, parent, item string) error

ItemRelationSetPropagation adds a propagation on an item relation.

func (*TestContext) LogsShouldContain

func (ctx *TestContext) LogsShouldContain(docString *godog.DocString) error

LogsShouldContain checks that the logs contain a provided string.

func (*TestContext) ScenarioTeardown

func (ctx *TestContext) ScenarioTeardown(*godog.Scenario, error)

ScenarioTeardown is called after each scenario to remove stubs.

func (*TestContext) SetupTestContext

func (ctx *TestContext) SetupTestContext(sc *godog.Scenario)

SetupTestContext initializes the test context. Called before each scenario.

func (*TestContext) SignedTokenIsDistributed

func (ctx *TestContext) SignedTokenIsDistributed(
	varName, signerName string,
	jsonPayload *godog.DocString,
) error

SignedTokenIsDistributed declares a signed token and puts it in a global variable. This allows later use inside a request, or a comparison with a response.

func (*TestContext) TableAtColumnValueShouldBe

func (ctx *TestContext) TableAtColumnValueShouldBe(
	tableName, columnName, columnValues string, data *godog.Table,
) error

TableAtColumnValueShouldBe verifies that the rows of the DB table having the provided values in the specified column match the provided data.

func (*TestContext) TableAtColumnValueShouldBeEmpty

func (ctx *TestContext) TableAtColumnValueShouldBeEmpty(tableName, columnName, valuesStr string) error

TableAtColumnValueShouldBeEmpty verifies that the DB table does not contain rows having the provided values in the specified column.

func (*TestContext) TableShouldBe

func (ctx *TestContext) TableShouldBe(tableName string, data *godog.Table) error

TableShouldBe verifies that the DB table matches the provided data.

func (*TestContext) TableShouldBeEmpty

func (ctx *TestContext) TableShouldBeEmpty(tableName string) error

TableShouldBeEmpty verifies that the DB table is empty.

func (*TestContext) TableShouldNotContainColumnValue

func (ctx *TestContext) TableShouldNotContainColumnValue(
	tableName, columnName, columnValues string,
) error

TableShouldNotContainColumnValue verifies that the DB table does not contain rows having the provided values in the specified column.

func (*TestContext) TableShouldStayUnchanged

func (ctx *TestContext) TableShouldStayUnchanged(tableName string) error

TableShouldStayUnchanged checks that the DB table has not changed.

func (*TestContext) TableShouldStayUnchangedButTheRowWithColumnValue

func (ctx *TestContext) TableShouldStayUnchangedButTheRowWithColumnValue(tableName, columnName, columnValues string) error

TableShouldStayUnchangedButTheRowWithColumnValue checks that the DB table has not changed except for rows with the specified values in the specified column.

func (*TestContext) TableShouldStayUnchangedButTheRowsWithColumnValueShouldBeDeleted

func (ctx *TestContext) TableShouldStayUnchangedButTheRowsWithColumnValueShouldBeDeleted(
	tableName, columnNames, columnValues string,
) error

TableShouldStayUnchangedButTheRowsWithColumnValueShouldBeDeleted checks for row deletion.

func (*TestContext) TheApplicationConfigIs

func (ctx *TestContext) TheApplicationConfigIs(yamlConfig *godog.DocString) error

TheApplicationConfigIs specifies variables of the app configuration given in YAML format.

func (*TestContext) TheContextVariableIs

func (ctx *TestContext) TheContextVariableIs(variableName, value string) error

TheContextVariableIs sets a context variable in the request http.Request as the provided value. Can be retrieved from the request with r.Context().Value(service.APIServiceContextVariableName("variableName")).

func (*TestContext) TheFieldOfTheGroupShouldBe

func (ctx *TestContext) TheFieldOfTheGroupShouldBe(field, group, value string) error

TheFieldOfTheGroupShouldBe checks that the field of a group in the database is equal to a value.

func (*TestContext) TheGeneratedAuthKeyIs

func (ctx *TestContext) TheGeneratedAuthKeyIs(generatedKey string) error

TheGeneratedAuthKeyIs stubs auth.GenerateKey to return the provided auth key instead of a random one.

func (*TestContext) TheGeneratedGroupCodeIs

func (ctx *TestContext) TheGeneratedGroupCodeIs(generatedCode string) error

TheGeneratedGroupCodeIs stubs groups.GenerateGroupCode to return the provided code instead of a random one.

func (*TestContext) TheGeneratedGroupCodesAre

func (ctx *TestContext) TheGeneratedGroupCodesAre(generatedCodes string) error

TheGeneratedGroupCodesAre stubs groups.GenerateGroupCode to generate the provided codes instead of random ones. generatedCodes is in the following form: example for three codes: "code1","code2","code3" with an arbitrary number of codes.

func (*TestContext) TheLoginModuleAccountEndpointForTokenReturns

func (ctx *TestContext) TheLoginModuleAccountEndpointForTokenReturns(
	authToken string,
	statusCode int,
	body *godog.DocString,
) error

TheLoginModuleAccountEndpointForTokenReturns mocks the return of the login module /user_api/account with the provided authorization token.

func (*TestContext) TheLoginModuleCreateEndpointWithParamsReturns

func (ctx *TestContext) TheLoginModuleCreateEndpointWithParamsReturns(
	params string, statusCode int, body *godog.DocString,
) error

TheLoginModuleCreateEndpointWithParamsReturns mocks the return of the login module /platform_api/accounts_manager/create with the provided parameters, return status, and body.

func (*TestContext) TheLoginModuleDeleteEndpointWithParamsReturns

func (ctx *TestContext) TheLoginModuleDeleteEndpointWithParamsReturns(
	params string, statusCode int, body *godog.DocString,
) error

TheLoginModuleDeleteEndpointWithParamsReturns mocks the return of the login module /platform_api/accounts_manager/delete with the provided parameters, return status, and body.

func (*TestContext) TheLoginModuleLTIResultSendEndpointForUserIDContentIDScoreReturns

func (ctx *TestContext) TheLoginModuleLTIResultSendEndpointForUserIDContentIDScoreReturns(
	userID, contentID, score string, statusCode int, body *godog.DocString,
) error

TheLoginModuleLTIResultSendEndpointForUserIDContentIDScoreReturns mocks the return of the login module /platform_api/lti_result/send with the provided user_id, content_id, and score.

func (*TestContext) TheLoginModuleTokenEndpointForCodeAndCodeVerifierAndRedirectURIReturns

func (ctx *TestContext) TheLoginModuleTokenEndpointForCodeAndCodeVerifierAndRedirectURIReturns(
	code, codeVerifier, redirectURI string,
	statusCode int,
	body *godog.DocString,
) error

TheLoginModuleTokenEndpointForCodeAndCodeVerifierAndRedirectURIReturns mocks the return of the login module /oauth/token, called with the provided code, code_verifier, and redirect_uri.

func (*TestContext) TheLoginModuleTokenEndpointForCodeAndCodeVerifierReturns

func (ctx *TestContext) TheLoginModuleTokenEndpointForCodeAndCodeVerifierReturns(
	code, codeVerifier string,
	statusCode int,
	body *godog.DocString,
) error

TheLoginModuleTokenEndpointForCodeAndCodeVerifierReturns mocks the return of the login module /oauth/token, called with the provided code and code_verifier.

func (*TestContext) TheLoginModuleTokenEndpointForCodeReturns

func (ctx *TestContext) TheLoginModuleTokenEndpointForCodeReturns(
	code string,
	statusCode int,
	body *godog.DocString,
) error

TheLoginModuleTokenEndpointForCodeReturns mocks the return of the login module /oauth/token, called with a provided code.

func (*TestContext) TheLoginModuleTokenEndpointForRefreshTokenReturns

func (ctx *TestContext) TheLoginModuleTokenEndpointForRefreshTokenReturns(
	refreshToken string,
	statusCode int,
	body *godog.DocString,
) error

TheLoginModuleTokenEndpointForRefreshTokenReturns mocks the return of the login module /oauth/token, called with the provided refresh_token.

func (*TestContext) TheLoginModuleUnlinkClientEndpointForUserIDReturns

func (ctx *TestContext) TheLoginModuleUnlinkClientEndpointForUserIDReturns(
	userID string, statusCode int, body *godog.DocString,
) error

TheLoginModuleUnlinkClientEndpointForUserIDReturns mocks the return of the login module /platform_api/accounts_manager/unlink_client with the provided user_id.

func (*TestContext) TheRequestHeaderIs

func (ctx *TestContext) TheRequestHeaderIs(name, value string) error

func (*TestContext) TheResponseAtInJSONShouldBe

func (ctx *TestContext) TheResponseAtInJSONShouldBe(jsonPath string, wants *godog.DocString) error

TheResponseAtInJSONShouldBe checks that the response in JSON at a JSONPath matches.

func (*TestContext) TheResponseAtShouldBe

func (ctx *TestContext) TheResponseAtShouldBe(jsonPath string, wants *godog.Table) error

TheResponseAtShouldBe checks that the response at a JSONPath matches multiple values.

func (*TestContext) TheResponseAtShouldBeTheBase64OfAnAES256GCMEncryptedJSONObjectContaining

func (ctx *TestContext) TheResponseAtShouldBeTheBase64OfAnAES256GCMEncryptedJSONObjectContaining(
	jsonPath string,
	expectedJSONParam *godog.DocString,
) error

TheResponseAtShouldBeTheBase64OfAnAES256GCMEncryptedJSONObjectContaining checks that the response at a JSONPath is an AES256GCM encrypted JSON object.

func (*TestContext) TheResponseAtShouldBeTheValue

func (ctx *TestContext) TheResponseAtShouldBeTheValue(jsonPath, value string) error

TheResponseAtShouldBeTheValue checks that the response at a JSONPath is a certain value.

func (*TestContext) TheResponseBodyShouldBe

func (ctx *TestContext) TheResponseBodyShouldBe(body *godog.DocString) (err error)

TheResponseBodyShouldBe checks that the response is the same as the one provided.

func (*TestContext) TheResponseBodyShouldBeJSON

func (ctx *TestContext) TheResponseBodyShouldBeJSON(body *godog.DocString) (err error)

func (*TestContext) TheResponseCodeShouldBe

func (ctx *TestContext) TheResponseCodeShouldBe(code int) error

func (*TestContext) TheResponseDecodedBodyShouldBeJSON

func (ctx *TestContext) TheResponseDecodedBodyShouldBeJSON(responseType string, body *godog.DocString) (err error)

func (*TestContext) TheResponseErrorMessageShouldContain

func (ctx *TestContext) TheResponseErrorMessageShouldContain(s string) (err error)

TheResponseErrorMessageShouldContain checks that the response contains the provided string.

func (*TestContext) TheResponseHeaderShouldBe

func (ctx *TestContext) TheResponseHeaderShouldBe(headerName, headerValue string) (err error)

TheResponseHeaderShouldBe checks that the response header matches the provided value.

func (*TestContext) TheResponseHeaderShouldNotBeSet

func (ctx *TestContext) TheResponseHeaderShouldNotBeSet(headerName string) (err error)

TheResponseHeaderShouldNotBeSet checks that the response header is not set.

func (*TestContext) TheResponseHeadersShouldBe

func (ctx *TestContext) TheResponseHeadersShouldBe(
	headerName string,
	headersValue *godog.DocString,
) (err error)

TheResponseHeadersShouldBe checks that the response header matches the multiline provided value.

func (*TestContext) TheResponseShouldBe

func (ctx *TestContext) TheResponseShouldBe(kind string) error

TheResponseShouldBe checks that the response status of the response is of the given kind.

func (*TestContext) TheTemplateConstantIsDocString

func (ctx *TestContext) TheTemplateConstantIsDocString(name string, value *godog.DocString) error

func (*TestContext) TheTemplateConstantIsString

func (ctx *TestContext) TheTemplateConstantIsString(name, value string) error

func (*TestContext) ThereAreCountAccessTokensForUser

func (ctx *TestContext) ThereAreCountAccessTokensForUser(count int, user string) error

ThereAreCountAccessTokensForUser checks if there are a given number of access tokens for a given user.

func (*TestContext) ThereAreCountSessionsForUser

func (ctx *TestContext) ThereAreCountSessionsForUser(count int, user string) error

ThereAreCountSessionsForUser checks if there are a given number of sessions for a given user.

func (*TestContext) ThereAreTheFollowingAccessTokens

func (ctx *TestContext) ThereAreTheFollowingAccessTokens(accessTokens *godog.Table) error

ThereAreTheFollowingAccessTokens create access tokens.

func (*TestContext) ThereAreTheFollowingGroupPendingRequests

func (ctx *TestContext) ThereAreTheFollowingGroupPendingRequests(entries *godog.Table) error

ThereAreTheFollowingGroupPendingRequests adds the group pending requests in the database.

func (*TestContext) ThereAreTheFollowingGroups

func (ctx *TestContext) ThereAreTheFollowingGroups(groups *godog.Table) error

ThereAreTheFollowingGroups defines groups.

func (*TestContext) ThereAreTheFollowingItemPermissions

func (ctx *TestContext) ThereAreTheFollowingItemPermissions(itemPermissions *godog.Table) error

ThereAreTheFollowingItemPermissions defines item permissions.

func (*TestContext) ThereAreTheFollowingItemRelations

func (ctx *TestContext) ThereAreTheFollowingItemRelations(itemPermissions *godog.Table) error

ThereAreTheFollowingItemRelations defines item relations, in items_items table.

func (*TestContext) ThereAreTheFollowingItems

func (ctx *TestContext) ThereAreTheFollowingItems(items *godog.Table) error

ThereAreTheFollowingItems defines items.

func (*TestContext) ThereAreTheFollowingResults

func (ctx *TestContext) ThereAreTheFollowingResults(results *godog.Table) error

ThereAreTheFollowingResults creates validated results described in the given Godog table.

func (*TestContext) ThereAreTheFollowingSessions

func (ctx *TestContext) ThereAreTheFollowingSessions(sessions *godog.Table) error

ThereAreTheFollowingSessions create sessions.

func (*TestContext) ThereAreTheFollowingTasks

func (ctx *TestContext) ThereAreTheFollowingTasks(tasks *godog.Table) error

ThereAreTheFollowingTasks defines item tasks.

func (*TestContext) ThereAreTheFollowingThreads

func (ctx *TestContext) ThereAreTheFollowingThreads(threads *godog.Table) error

ThereAreTheFollowingThreads create threads.

func (*TestContext) ThereAreTheFollowingUsers

func (ctx *TestContext) ThereAreTheFollowingUsers(users *godog.Table) error

ThereAreTheFollowingUsers defines users.

func (*TestContext) ThereIsAGroup

func (ctx *TestContext) ThereIsAGroup(group string) error

ThereIsAGroup creates a new group.

func (*TestContext) ThereIsAThreadWith

func (ctx *TestContext) ThereIsAThreadWith(parameters string) error

ThereIsAThreadWith creates a thread.

func (*TestContext) ThereIsAUser

func (ctx *TestContext) ThereIsAUser(name string) error

ThereIsAUser create a user.

func (*TestContext) ThereIsNoAccessToken

func (ctx *TestContext) ThereIsNoAccessToken(accessToken string) error

ThereIsNoAccessToken checks that an access token doesn't exist.

func (*TestContext) ThereIsNoSessionID

func (ctx *TestContext) ThereIsNoSessionID(session string) error

ThereIsNoSessionID checks that a session with given session ID doesn't exist.

func (*TestContext) ThereIsNoThreadWith

func (ctx *TestContext) ThereIsNoThreadWith(parameters string) error

ThereIsNoThreadWith states that a given thread doesn't exist.

func (*TestContext) ThereShouldBeNoGroupPendingRequestsForTheGroupWithTheType

func (ctx *TestContext) ThereShouldBeNoGroupPendingRequestsForTheGroupWithTheType(group, requestType string) error

ThereShouldBeNoGroupPendingRequestsForTheGroupWithTheType checks that no rows are present in the group_pending_requests table.

func (*TestContext) ThereShouldBeNoGroupPendingRequestsForTheMemberWithTheType

func (ctx *TestContext) ThereShouldBeNoGroupPendingRequestsForTheMemberWithTheType(member, requestType string) error

ThereShouldBeNoGroupPendingRequestsForTheMemberWithTheType checks that no rows are present in the group_pending_requests table.

func (*TestContext) ThereShouldBeTheFollowingGroupMembershipChanges

func (ctx *TestContext) ThereShouldBeTheFollowingGroupMembershipChanges(entries *godog.Table) error

ThereShouldBeTheFollowingGroupMembershipChanges checks that rows are present in the group_membership_changes table of the database.

func (*TestContext) ThereShouldBeTheFollowingGroupPendingRequests

func (ctx *TestContext) ThereShouldBeTheFollowingGroupPendingRequests(entries *godog.Table) error

ThereShouldBeTheFollowingGroupPendingRequests checks that rows are present in the group_pending_requests table of the database.

func (*TestContext) TimeIsFrozen

func (ctx *TestContext) TimeIsFrozen() error

TimeIsFrozen stubs time.Now to the current time.

func (*TestContext) TimeNow

func (ctx *TestContext) TimeNow(timeStr string) error

TimeNow stubs time.Now to the provided time.

func (*TestContext) UserCanGrantViewOnItemWithID

func (ctx *TestContext) UserCanGrantViewOnItemWithID(viewValue, user, item string) error

UserCanGrantViewOnItemWithID gives a user a can_grant_view permission on an item.

func (*TestContext) UserCanRequestHelpToOnItemWithID

func (ctx *TestContext) UserCanRequestHelpToOnItemWithID(canRequestHelpTo, user, item string) error

UserCanRequestHelpToOnItemWithID sets the can_request_help_to permission.

func (*TestContext) UserCanViewOnItemWithID

func (ctx *TestContext) UserCanViewOnItemWithID(viewValue, user, item string) error

UserCanViewOnItemWithID gives a user a can_view permission on an item.

func (*TestContext) UserCanWatchOnItemWithID

func (ctx *TestContext) UserCanWatchOnItemWithID(watchValue, user, item string) error

UserCanWatchOnItemWithID gives a user a "watch" permission on an item.

func (*TestContext) UserIsAManagerOfTheGroupAndCanGrantGroupAccess

func (ctx *TestContext) UserIsAManagerOfTheGroupAndCanGrantGroupAccess(user, group string) error

UserIsAManagerOfTheGroupAndCanGrantGroupAccess sets the user as a manager of the group with can_grant_group_access permission.

func (*TestContext) UserIsAManagerOfTheGroupAndCanManageMembershipsAndGroup

func (ctx *TestContext) UserIsAManagerOfTheGroupAndCanManageMembershipsAndGroup(user, group string) error

UserIsAManagerOfTheGroupAndCanManageMembershipsAndGroup adds the user as a manager of the group with the can_manage=memberships_and_groups permission.

func (*TestContext) UserIsAManagerOfTheGroupAndCanWatchItsMembers

func (ctx *TestContext) UserIsAManagerOfTheGroupAndCanWatchItsMembers(user, group string) error

UserIsAManagerOfTheGroupAndCanWatchItsMembers sets the user as a manager of the group with can_watch permission.

func (*TestContext) UserIsAManagerOfTheGroupWith

func (ctx *TestContext) UserIsAManagerOfTheGroupWith(parameters string) error

UserIsAManagerOfTheGroupWith sets the current user as the manager of a group.

func (*TestContext) UserIsAMemberOfTheGroup

func (ctx *TestContext) UserIsAMemberOfTheGroup(user, group string) error

UserIsAMemberOfTheGroup puts a user in a group.

func (*TestContext) UserIsAMemberOfTheGroupWhoHasApprovedAccessToHisPersonalInfo

func (ctx *TestContext) UserIsAMemberOfTheGroupWhoHasApprovedAccessToHisPersonalInfo(user, group string) error

UserIsAMemberOfTheGroupWhoHasApprovedAccessToHisPersonalInfo puts a user in a group with approved access to his personnel info.

func (*TestContext) UserIsOwnerOfItemWithID

func (ctx *TestContext) UserIsOwnerOfItemWithID(isOwner, user, item string) error

UserIsOwnerOfItemWithID sets the is_owner permission.

func (*TestContext) UserSetPermissionExtendedOnItemWithID

func (ctx *TestContext) UserSetPermissionExtendedOnItemWithID(permission, value, user, item, sourceGroup, origin string) error

UserSetPermissionExtendedOnItemWithID gives a user a permission on an item with a specific source_group and origin.

func (*TestContext) UserSetPermissionOnItemWithID

func (ctx *TestContext) UserSetPermissionOnItemWithID(permission, value, user, item string) error

UserSetPermissionOnItemWithID gives a user a permission on an item.

func (*TestContext) UserShouldBeAMemberOfTheGroup

func (ctx *TestContext) UserShouldBeAMemberOfTheGroup(user, group string) error

UserShouldBeAMemberOfTheGroup checks that the user is a member of the group.

func (*TestContext) UserShouldNotBeAMemberOfTheGroup

func (ctx *TestContext) UserShouldNotBeAMemberOfTheGroup(user, group string) error

UserShouldNotBeAMemberOfTheGroup checks that the user is not a member of the group.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL