Documentation ¶
Index ¶
- Variables
- func N() int64
- func Now() time.Time
- func S(str string) string
- func T(t string) time.Time
- type Config
- type Factory
- type Item
- type Matrix
- type Query
- type Result
- type Tester
- func (t *Tester) Authenticate(clientID, username, password string, scope ...string)
- func (t *Tester) Await(tt *testing.T, timeout time.Duration, fns ...func()) int
- func (t *Tester) Call(tt *testing.T, url string, in, out any) (int, *jsonapi.Error)
- func (t *Tester) Create(tt *testing.T, model, response, result coal.Model) Result
- func (t *Tester) CreateError(tt *testing.T, model coal.Model, e error) Result
- func (t *Tester) Delete(tt *testing.T, model, result coal.Model) Result
- func (t *Tester) DeleteError(tt *testing.T, model coal.Model, e error) Result
- func (t *Tester) Download(tt *testing.T, key string, typ, name string, data []byte) []byte
- func (t *Tester) Find(tt *testing.T, model coal.Model, response coal.Model) Result
- func (t *Tester) FindError(tt *testing.T, model coal.Model, e error) Result
- func (t *Tester) Invalidate()
- func (t *Tester) List(tt *testing.T, model coal.Model, response []coal.Model) Result
- func (t *Tester) ListError(tt *testing.T, model coal.Model, e error) Result
- func (t *Tester) URL(path ...string) string
- func (t *Tester) Update(tt *testing.T, model, response, result coal.Model) Result
- func (t *Tester) UpdateError(tt *testing.T, model coal.Model, e error) Result
- func (t *Tester) Upload(tt *testing.T, data []byte, typ, name string) string
Constants ¶
This section is empty.
Variables ¶
var AccessDenied = fire.ErrAccessDenied.Self()
AccessDenied is the raw access denied error value.
var DocumentNotUnique = fire.ErrDocumentNotUnique.Self()
DocumentNotUnique is thr raw document not unique error value.
var Ignore = any(ignore{})
Ignore may be returned by generate to ignore an item.
var ResourceNotFound = fire.ErrResourceNotFound.Self()
ResourceNotFound is the raw resource not found error value.
Functions ¶
Types ¶
type Config ¶
type Config struct { Tester *fire.Tester Store *coal.Store // ignored, if Tester is provided Models []coal.Model // ignored, if Tester is provided Handler http.Handler DataNamespace string AuthNamespace string TokenEndpoint string UploadEndpoint string DownloadEndpoint string Authorizer func(req *http.Request) Debug bool }
Config provides configuration of a tester.
type Factory ¶
type Factory struct {
// contains filtered or unexported fields
}
Factory is model factory for tests.
func NewFactory ¶
NewFactory creates and returns a new factory.
func (*Factory) Insert ¶
Insert make and insert a new model with the provided models merged into the registered base model.
type Item ¶ added in v0.33.0
Item is single combination of dimensions.
type Matrix ¶ added in v0.33.0
type Matrix struct {
// contains filtered or unexported fields
}
Matrix provides a facility for matrix testing.
func (*Matrix) Generate ¶ added in v0.33.0
Generate will generate a dimension using the specified values and generator. The generator may be absent to just add the provided values. If the generator returns Ignore the value will be skipped.
type Tester ¶
type Tester struct { *fire.Tester Config Config RawClient *http.Client DataClient *fire.Client AuthClient *oauth2.Client AuthToken string }
Tester provides a high-level unit test facility.
func (*Tester) Authenticate ¶
Authenticate will request an access token using the provided credentials.
func (*Tester) Await ¶ added in v0.33.1
Await will wait for all jobs created during the execution of the callback to complete. A timeout may be provided to stop after some time.
func (*Tester) Call ¶ added in v0.33.1
Call will call a JSON based action with the provided input and output at the specified URL. If out is absent, the function will try to decode and return any jsonapi.Error.
func (*Tester) Create ¶
Create will create the provided model and validate the response and result if requested.
func (*Tester) CreateError ¶
CreateError will create the provided model and expect and error.
func (*Tester) DeleteError ¶
DeleteError will delete the provided model and expect an error.
func (*Tester) Download ¶ added in v0.33.0
Download will download data using the specified view key. It will verify the files media type, name and data if requested.
func (*Tester) Invalidate ¶
func (t *Tester) Invalidate()
Invalidate will clear the current authentication.
func (*Tester) Update ¶
Update will update the provided model and validate the response and result if requested.
func (*Tester) UpdateError ¶
UpdateError will update the provided model and expect an error.