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) 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) 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().(*xo.Err).Err
AccessDenied is the raw access denied error value.
var Ignore = any(ignore{})
Ignore may be returned by generate to ignore an item.
var ResourceNotFound = fire.ErrResourceNotFound.Self().(*xo.Err).Err
ResourceNotFound is the raw resource not found error value.
Functions ¶
Types ¶
type Config ¶
type Config struct {
Store *coal.Store
Models []coal.Model
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
RawClient *http.Client
DataClient *fire.Client
AuthClient *oauth2.Client
AuthToken string
UploadURL string
DownloadURL string
}
Tester provides a high-level unit test facility.
func (*Tester) Authenticate ¶
Authenticate will request an access token using the provided credentials.
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.