Documentation ¶
Index ¶
- type APIFeature
- func (f *APIFeature) IAmAuthorised() error
- func (f *APIFeature) IAmNotAuthorised() error
- func (f *APIFeature) IDelete(path string) error
- func (f *APIFeature) IGet(path string) error
- func (f *APIFeature) IPatch(path string, body *godog.DocString) error
- func (f *APIFeature) IPostToWithBody(path string, body *godog.DocString) error
- func (f *APIFeature) IPut(path string, body *godog.DocString) error
- func (f *APIFeature) ISetTheHeaderTo(header, value string) error
- func (f *APIFeature) IShouldReceiveTheFollowingJSONResponse(expectedAPIResponse *godog.DocString) error
- func (f *APIFeature) IShouldReceiveTheFollowingJSONResponseWithStatus(expectedCodeStr string, expectedBody *godog.DocString) error
- func (f *APIFeature) IShouldReceiveTheFollowingResponse(expectedAPIResponse *godog.DocString) error
- func (f *APIFeature) IUseAServiceAuthToken(serviceAuthToken string) error
- func (f *APIFeature) IUseAnXFlorenceUserToken(xFlorenceToken string) error
- func (f *APIFeature) RegisterSteps(ctx *godog.ScenarioContext)
- func (f *APIFeature) Reset()
- func (f *APIFeature) TheHTTPStatusCodeShouldBe(expectedCodeStr string) error
- func (f *APIFeature) TheResponseHeaderShouldBe(headerName, expectedValue string) error
- type AuthorizationFeature
- type Chrome
- type ErrorFeature
- func (t *ErrorFeature) Errorf(format string, args ...interface{})
- func (t *ErrorFeature) Helper()
- func (t *ErrorFeature) Log(_ ...interface{})
- func (t *ErrorFeature) Logf(format string, args ...interface{})
- func (t *ErrorFeature) Name() string
- func (t *ErrorFeature) Reset()
- func (t *ErrorFeature) StepError() error
- type MongoCollectionDeletedDocs
- type MongoDeletedDocs
- type MongoFeature
- func (m *MongoFeature) Close() error
- func (m *MongoFeature) RegisterSteps(ctx *godog.ScenarioContext)
- func (m *MongoFeature) RemoveAllDataFromCollections(collectionNames string) error
- func (m *MongoFeature) RemoveAllDataFromDatabase() error
- func (m *MongoFeature) Reset() error
- func (m *MongoFeature) ResetCollections(ctx context.Context, databaseName string, collectionNames []string) (*MongoDeletedDocs, error)
- func (m *MongoFeature) ResetDatabase(ctx context.Context, databaseName string) (*MongoDeletedDocs, error)
- func (m *MongoFeature) TheFollowingDocumentExistsInTheCollection(collectionName string, document *godog.DocString) error
- type MongoOptions
- type ServiceInitialiser
- type UIFeature
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIFeature ¶
type APIFeature struct { ErrorFeature Initialiser ServiceInitialiser HTTPResponse *http.Response BeforeRequestHook func() error // contains filtered or unexported fields }
APIFeature contains the information needed to test REST API requests
func NewAPIFeature ¶
func NewAPIFeature(initialiser ServiceInitialiser) *APIFeature
NewAPIFeature returns a new APIFeature, takes a function to retrieve the bound handler just before a request is made
func NewAPIFeatureWithHandler ¶
func NewAPIFeatureWithHandler(handler http.Handler) *APIFeature
NewAPIFeatureWithHandler create a new APIFeature with a handler already bound with your endpoints
func (*APIFeature) IAmAuthorised ¶
func (f *APIFeature) IAmAuthorised() error
IAmAuthorised sets the Authorization header to a bogus token
func (*APIFeature) IAmNotAuthorised ¶
func (f *APIFeature) IAmNotAuthorised() error
IAmNotAuthorised removes any Authorization header set in the request headers
func (*APIFeature) IDelete ¶ added in v0.4.0
func (f *APIFeature) IDelete(path string) error
IDelete makes a DELETE request to the provided path with the current headers
func (*APIFeature) IGet ¶
func (f *APIFeature) IGet(path string) error
IGet makes a get request to the provided path with the current headers
func (*APIFeature) IPatch ¶ added in v0.4.1
func (f *APIFeature) IPatch(path string, body *godog.DocString) error
IPatch makes a PATCH request to the provided path with the current headers and the body provided
func (*APIFeature) IPostToWithBody ¶
func (f *APIFeature) IPostToWithBody(path string, body *godog.DocString) error
IPostToWithBody makes a POST request to the provided path with the current headers and the body provided
func (*APIFeature) IPut ¶ added in v0.4.0
func (f *APIFeature) IPut(path string, body *godog.DocString) error
IPut makes a PUT request to the provided path with the current headers and the body provided
func (*APIFeature) ISetTheHeaderTo ¶
func (f *APIFeature) ISetTheHeaderTo(header, value string) error
ISetTheHeaderTo is a default step used to set a header and associated value for the next request
func (*APIFeature) IShouldReceiveTheFollowingJSONResponse ¶
func (f *APIFeature) IShouldReceiveTheFollowingJSONResponse(expectedAPIResponse *godog.DocString) error
IShouldReceiveTheFollowingJSONResponse asserts that the response body and expected response body are equal
func (*APIFeature) IShouldReceiveTheFollowingJSONResponseWithStatus ¶
func (f *APIFeature) IShouldReceiveTheFollowingJSONResponseWithStatus(expectedCodeStr string, expectedBody *godog.DocString) error
IShouldReceiveTheFollowingJSONResponseWithStatus asserts the response code and body match the expectation
func (*APIFeature) IShouldReceiveTheFollowingResponse ¶
func (f *APIFeature) IShouldReceiveTheFollowingResponse(expectedAPIResponse *godog.DocString) error
IShouldReceiveTheFollowingResponse asserts the response body and expected response body are equal
func (*APIFeature) IUseAServiceAuthToken ¶ added in v0.6.0
func (f *APIFeature) IUseAServiceAuthToken(serviceAuthToken string) error
func (*APIFeature) IUseAnXFlorenceUserToken ¶ added in v0.6.0
func (f *APIFeature) IUseAnXFlorenceUserToken(xFlorenceToken string) error
func (*APIFeature) RegisterSteps ¶
func (f *APIFeature) RegisterSteps(ctx *godog.ScenarioContext)
RegisterSteps binds the APIFeature steps to the godog context to enable usage in the component tests
func (*APIFeature) TheHTTPStatusCodeShouldBe ¶
func (f *APIFeature) TheHTTPStatusCodeShouldBe(expectedCodeStr string) error
TheHTTPStatusCodeShouldBe asserts that the status code of the response matches the expected code
func (*APIFeature) TheResponseHeaderShouldBe ¶
func (f *APIFeature) TheResponseHeaderShouldBe(headerName, expectedValue string) error
TheResponseHeaderShouldBe asserts the response header matches the expectation
type AuthorizationFeature ¶
type AuthorizationFeature struct { ErrorFeature FakeAuthService *httpfake.HTTPFake }
func NewAuthorizationFeature ¶
func NewAuthorizationFeature() *AuthorizationFeature
func (*AuthorizationFeature) Close ¶
func (f *AuthorizationFeature) Close()
func (*AuthorizationFeature) RegisterSteps ¶
func (f *AuthorizationFeature) RegisterSteps(ctx *godog.ScenarioContext)
func (*AuthorizationFeature) Reset ¶
func (f *AuthorizationFeature) Reset()
type Chrome ¶ added in v0.6.5
type Chrome struct { ExecAllocatorCanceller context.CancelFunc CtxCanceller context.CancelFunc Ctx context.Context }
Chrome contains Chrome session-related resources
type ErrorFeature ¶
func (*ErrorFeature) Errorf ¶
func (t *ErrorFeature) Errorf(format string, args ...interface{})
func (*ErrorFeature) Helper ¶ added in v0.3.0
func (t *ErrorFeature) Helper()
func (*ErrorFeature) Log ¶ added in v0.3.0
func (t *ErrorFeature) Log(_ ...interface{})
func (*ErrorFeature) Logf ¶ added in v0.3.0
func (t *ErrorFeature) Logf(format string, args ...interface{})
func (*ErrorFeature) Name ¶ added in v0.3.0
func (t *ErrorFeature) Name() string
func (*ErrorFeature) Reset ¶ added in v0.8.0
func (t *ErrorFeature) Reset()
func (*ErrorFeature) StepError ¶
func (t *ErrorFeature) StepError() error
type MongoCollectionDeletedDocs ¶ added in v0.8.0
MongoCollectionDeletedDocs contains the number of document deleted from collection
type MongoDeletedDocs ¶ added in v0.8.0
type MongoDeletedDocs struct { Database string Count int64 Collections []MongoCollectionDeletedDocs }
MongoDeletedDocs contains a list of counts for all deleted documents against a given collection of a mongo database
type MongoFeature ¶
MongoFeature is a struct containing an in-memory mongo database
func NewMongoFeature ¶
func NewMongoFeature(mongoOptions MongoOptions) *MongoFeature
NewMongoFeature creates a new in-memory mongo database using the supplied options
func (*MongoFeature) Close ¶
func (m *MongoFeature) Close() error
Close stops the in-memory mongo database
func (*MongoFeature) RegisterSteps ¶
func (m *MongoFeature) RegisterSteps(ctx *godog.ScenarioContext)
func (*MongoFeature) RemoveAllDataFromCollections ¶ added in v0.8.0
func (m *MongoFeature) RemoveAllDataFromCollections(collectionNames string) error
func (*MongoFeature) RemoveAllDataFromDatabase ¶ added in v0.8.0
func (m *MongoFeature) RemoveAllDataFromDatabase() error
func (*MongoFeature) Reset ¶
func (m *MongoFeature) Reset() error
Reset is currently not implemented
func (*MongoFeature) ResetCollections ¶ added in v0.8.0
func (m *MongoFeature) ResetCollections(ctx context.Context, databaseName string, collectionNames []string) (*MongoDeletedDocs, error)
ResetCollections removes all data in all collections specified within database
func (*MongoFeature) ResetDatabase ¶ added in v0.8.0
func (m *MongoFeature) ResetDatabase(ctx context.Context, databaseName string) (*MongoDeletedDocs, error)
ResetDatabase removes all data in all collections within database
func (*MongoFeature) TheFollowingDocumentExistsInTheCollection ¶
func (m *MongoFeature) TheFollowingDocumentExistsInTheCollection(collectionName string, document *godog.DocString) error
type MongoOptions ¶
MongoOptions contains a set of options required to create a new MongoFeature
type ServiceInitialiser ¶
func StaticHandler ¶
func StaticHandler(handler http.Handler) ServiceInitialiser
type UIFeature ¶ added in v0.6.5
type UIFeature struct { ErrorFeature BaseURL string Chrome Chrome WaitTimeOut time.Duration }
UIFeature contains the information needed to test UI interactions
func NewUIFeature ¶ added in v0.6.5
NewUIFeature returns a new UIFeature configured with baseURL
func (*UIFeature) RegisterSteps ¶ added in v0.6.5
func (f *UIFeature) RegisterSteps(ctx *godog.ScenarioContext)
RegisterSteps binds the APIFeature steps to the godog context to enable usage in the component tests