Documentation ¶
Overview ¶
Package mockups contains mockup objects and functions for tests.
Index ¶
- func AddApplicationsToDb(db *database.Database, apps []*model.Application) error
- func AddUsersToDb(db *database.Database, users []*model.User) ([]*model.User, error)
- func GetAdminUser(c *configuration.Configuration) *model.User
- func GetAllApplications() []*model.Application
- func GetApplication1() *model.Application
- func GetApplication2() *model.Application
- func GetEmptyDatabase(confCrypto configuration.CryptoConfig) (*database.Database, error)
- func GetUser(c *configuration.Configuration) *model.User
- func GetUsers(c *configuration.Configuration) []*model.User
- func ReadConfig(filename string, removeFile bool) (config *configuration.Configuration, err error)
- type MockDispatcher
- func (*MockDispatcher) DeleteNotification(_ *model.Application, _ *model.DeleteNotification) error
- func (*MockDispatcher) DeregisterApplication(_ *model.Application, _ *model.User) error
- func (*MockDispatcher) RegisterApplication(id uint, name, _ string) (string, error)
- func (*MockDispatcher) SendNotification(_ *model.Application, _ *model.Notification) (id string, err error)
- func (*MockDispatcher) UpdateApplication(_ *model.Application, _ *configuration.RepairBehavior) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddApplicationsToDb ¶
func AddApplicationsToDb(db *database.Database, apps []*model.Application) error
AddApplicationsToDb inserts the applications apps into the database db
func AddUsersToDb ¶
AddUsersToDb adds the users to the database and sets their username as a password, returns list of added users
func GetAdminUser ¶
func GetAdminUser(c *configuration.Configuration) *model.User
GetAdminUser returns an admin user
func GetAllApplications ¶
func GetAllApplications() []*model.Application
GetAllApplications returns all mock-applications as a list
func GetApplication1 ¶
func GetApplication1() *model.Application
GetApplication1 returns an application with id 1
func GetApplication2 ¶
func GetApplication2() *model.Application
GetApplication2 returns an application with id 2
func GetEmptyDatabase ¶
func GetEmptyDatabase(confCrypto configuration.CryptoConfig) (*database.Database, error)
GetEmptyDatabase returns an empty sqlite database object
func GetUsers ¶
func GetUsers(c *configuration.Configuration) []*model.User
GetUsers returns a list of users
func ReadConfig ¶
func ReadConfig(filename string, removeFile bool) (config *configuration.Configuration, err error)
ReadConfig copies the given filename to the current folder and parses it as a config file. RemoveFile indicates whether to remove the copied file or not
Types ¶
type MockDispatcher ¶
type MockDispatcher struct{}
MockDispatcher is a dispatcher used for testing - it does not need any storage interface
func (*MockDispatcher) DeleteNotification ¶ added in v0.8.0
func (*MockDispatcher) DeleteNotification(_ *model.Application, _ *model.DeleteNotification) error
DeleteNotification mocks a function to send a notification to a given user that another notification is deleted
func (*MockDispatcher) DeregisterApplication ¶
func (*MockDispatcher) DeregisterApplication(_ *model.Application, _ *model.User) error
DeregisterApplication mocks a function to delete a channel for an application.
func (*MockDispatcher) RegisterApplication ¶
func (*MockDispatcher) RegisterApplication(id uint, name, _ string) (string, error)
RegisterApplication mocks a functions to create a channel for an application.
func (*MockDispatcher) SendNotification ¶ added in v0.8.0
func (*MockDispatcher) SendNotification(_ *model.Application, _ *model.Notification) (id string, err error)
SendNotification mocks a function to send a notification to a given user.
func (*MockDispatcher) UpdateApplication ¶
func (*MockDispatcher) UpdateApplication(_ *model.Application, _ *configuration.RepairBehavior) error
UpdateApplication mocks a function to update a channel for an application.