Documentation ¶
Index ¶
- func BodyEquals(t assert.TestingT, obj interface{}, recorder *httptest.ResponseRecorder)
- func JSONEquals(t assert.TestingT, obj interface{}, expected string)
- func WithUser(ctx *gin.Context, userID uint)
- type AppClientBuilder
- func (ab *AppClientBuilder) App(id uint) *MessageBuilder
- func (ab *AppClientBuilder) AppWithToken(id uint, token string) *MessageBuilder
- func (ab *AppClientBuilder) AppWithTokenAndName(id uint, token, name string) *MessageBuilder
- func (ab *AppClientBuilder) Client(id uint) *AppClientBuilder
- func (ab *AppClientBuilder) ClientWithToken(id uint, token string) *AppClientBuilder
- func (ab *AppClientBuilder) NewAppWithToken(id uint, token string) *model.Application
- func (ab *AppClientBuilder) NewAppWithTokenAndName(id uint, token, name string) *model.Application
- func (ab *AppClientBuilder) NewClientWithToken(id uint, token string) *model.Client
- type Database
- func (d *Database) AssertAppExist(id uint)
- func (d *Database) AssertAppNotExist(id uint)
- func (d *Database) AssertClientExist(id uint)
- func (d *Database) AssertClientNotExist(id uint)
- func (d *Database) AssertMessageExist(id uint)
- func (d *Database) AssertMessageNotExist(ids ...uint)
- func (d *Database) AssertUserExist(id uint)
- func (d *Database) AssertUserNotExist(id uint)
- func (d *Database) NewUser(id uint) *model.User
- func (d *Database) NewUserWithName(id uint, name string) *model.User
- func (d *Database) User(id uint) *AppClientBuilder
- type MessageBuilder
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BodyEquals ¶
func BodyEquals(t assert.TestingT, obj interface{}, recorder *httptest.ResponseRecorder)
BodyEquals asserts the content from the response recorder with the encoded json of the provided instance.
func JSONEquals ¶
JSONEquals asserts the content of the string with the encoded json of the provided instance.
Types ¶
type AppClientBuilder ¶
type AppClientBuilder struct {
// contains filtered or unexported fields
}
AppClientBuilder has helper methods to create applications and clients.
func (*AppClientBuilder) App ¶
func (ab *AppClientBuilder) App(id uint) *MessageBuilder
App creates an application and returns a message builder.
func (*AppClientBuilder) AppWithToken ¶
func (ab *AppClientBuilder) AppWithToken(id uint, token string) *MessageBuilder
AppWithToken creates an application with a token and returns a message builder.
func (*AppClientBuilder) AppWithTokenAndName ¶ added in v1.2.0
func (ab *AppClientBuilder) AppWithTokenAndName(id uint, token, name string) *MessageBuilder
AppWithTokenAndName creates an application with a token and name and returns a message builder.
func (*AppClientBuilder) Client ¶
func (ab *AppClientBuilder) Client(id uint) *AppClientBuilder
Client creates a client and returns itself.
func (*AppClientBuilder) ClientWithToken ¶
func (ab *AppClientBuilder) ClientWithToken(id uint, token string) *AppClientBuilder
ClientWithToken creates a client with a token and returns itself.
func (*AppClientBuilder) NewAppWithToken ¶
func (ab *AppClientBuilder) NewAppWithToken(id uint, token string) *model.Application
NewAppWithToken creates an application with a token and returns the app.
func (*AppClientBuilder) NewAppWithTokenAndName ¶ added in v1.2.0
func (ab *AppClientBuilder) NewAppWithTokenAndName(id uint, token, name string) *model.Application
NewAppWithTokenAndName creates an application with a token and name and returns the app.
func (*AppClientBuilder) NewClientWithToken ¶
func (ab *AppClientBuilder) NewClientWithToken(id uint, token string) *model.Client
NewClientWithToken creates a client with a token and returns the client.
type Database ¶
type Database struct { *database.GormDatabase // contains filtered or unexported fields }
Database is the wrapper for the gorm database with sleek helper methods.
func NewDBWithDefaultUser ¶
NewDBWithDefaultUser creates a new test db instance with the default user.
func (*Database) AssertAppExist ¶
AssertAppExist asserts that the app does exist.
func (*Database) AssertAppNotExist ¶
AssertAppNotExist asserts that the app does not exist.
func (*Database) AssertClientExist ¶
AssertClientExist asserts that the client does exist.
func (*Database) AssertClientNotExist ¶
AssertClientNotExist asserts that the client does not exist.
func (*Database) AssertMessageExist ¶
AssertMessageExist asserts that the message does exist.
func (*Database) AssertMessageNotExist ¶
AssertMessageNotExist asserts that the messages does not exist.
func (*Database) AssertUserExist ¶
AssertUserExist asserts that the user does exist.
func (*Database) AssertUserNotExist ¶
AssertUserNotExist asserts that the user does not exist.
func (*Database) NewUserWithName ¶
NewUserWithName creates a user with a name and returns the user.
func (*Database) User ¶
func (d *Database) User(id uint) *AppClientBuilder
User creates a user and returns a builder for applications and clients.
type MessageBuilder ¶
type MessageBuilder struct {
// contains filtered or unexported fields
}
MessageBuilder has helper methods to create messages.
func (*MessageBuilder) Message ¶
func (mb *MessageBuilder) Message(id uint) *MessageBuilder
Message creates a message and returns itself
func (*MessageBuilder) NewMessage ¶
func (mb *MessageBuilder) NewMessage(id uint) model.Message
NewMessage creates a message and returns the message.