mock

package
v2.1.4 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2022 License: CC-BY-4.0, MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const ModulePath = "github.com/gotify/server/v2/plugin/testing/mock"

ModulePath is for convenient access of the module path of this mock plugin

View Source
const Name = "mock plugin"

Name is for convenient access of the module path of the name of this mock plugin

Variables

This section is empty.

Functions

func ReturnErrorOnDisableForUser

func ReturnErrorOnDisableForUser(uid uint, err error)

ReturnErrorOnDisableForUser registers a uid which will throw an error on disabling.

func ReturnErrorOnEnableForUser

func ReturnErrorOnEnableForUser(uid uint, err error)

ReturnErrorOnEnableForUser registers a uid which will throw an error on enabling.

Types

type Plugin

type Plugin struct {
	Instances []PluginInstance
}

Plugin is a mock plugin.

func (*Plugin) APIVersion

func (c *Plugin) APIVersion() string

APIVersion implements loader.PluginCompat

func (*Plugin) NewPluginInstance

func (c *Plugin) NewPluginInstance(ctx compat.UserContext) compat.PluginInstance

NewPluginInstance implements loader.PluginCompat

func (*Plugin) PluginInfo

func (c *Plugin) PluginInfo() compat.Info

PluginInfo implements loader.PluginCompat

type PluginConfig

type PluginConfig struct {
	TestKey    string
	IsNotValid bool
}

PluginConfig is a mock plugin config struct

type PluginInstance

type PluginInstance struct {
	UserCtx       compat.UserContext
	Enabled       bool
	DisplayString string
	Config        *PluginConfig

	BasePath string
	// contains filtered or unexported fields
}

PluginInstance is a mock plugin instance

func (*PluginInstance) DefaultConfig

func (c *PluginInstance) DefaultConfig() interface{}

DefaultConfig implements compat.Configuror

func (*PluginInstance) Disable

func (c *PluginInstance) Disable() error

Disable implements compat.PluginInstance

func (*PluginInstance) Enable

func (c *PluginInstance) Enable() error

Enable implements compat.PluginInstance

func (*PluginInstance) GetDisplay

func (c *PluginInstance) GetDisplay(url *url.URL) string

GetDisplay implements compat.Displayer

func (*PluginInstance) GetStorage

func (c *PluginInstance) GetStorage() ([]byte, error)

GetStorage sets current storage

func (*PluginInstance) RegisterWebhook

func (c *PluginInstance) RegisterWebhook(basePath string, mux *gin.RouterGroup)

RegisterWebhook implements compat.Webhooker

func (*PluginInstance) SetCapability

func (c *PluginInstance) SetCapability(p compat.Capability, enable bool)

SetCapability changes the capability of this plugin

func (*PluginInstance) SetMessageHandler

func (c *PluginInstance) SetMessageHandler(h compat.MessageHandler)

SetMessageHandler implements compat.Messenger

func (*PluginInstance) SetStorage

func (c *PluginInstance) SetStorage(b []byte) error

SetStorage sets current storage

func (*PluginInstance) SetStorageHandler

func (c *PluginInstance) SetStorageHandler(handler compat.StorageHandler)

SetStorageHandler implements compat.Storager

func (*PluginInstance) Supports

func (c *PluginInstance) Supports() compat.Capabilities

Supports implements compat.PluginInstance

func (*PluginInstance) TriggerMessage

func (c *PluginInstance) TriggerMessage()

TriggerMessage triggers a test message

func (*PluginInstance) ValidateAndSetConfig

func (c *PluginInstance) ValidateAndSetConfig(config interface{}) error

ValidateAndSetConfig implements compat.Configuror

Jump to

Keyboard shortcuts

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