mockups

package
v0.10.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 21, 2023 License: ISC Imports: 10 Imported by: 0

Documentation

Overview

Package mockups contains mockup objects and functions for tests.

Index

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

func AddUsersToDb(db *database.Database, users []*model.User) ([]*model.User, error)

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 GetUser

GetUser returns an user

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

UpdateApplication mocks a function to update a channel for an application.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL