Documentation
¶
Index ¶
- func CreateTestContext(username, projectId string) context.Context
- type Specification
- func (spec *Specification) AddConnectedPlug(iface interfaces.Interface, plug *interfaces.ConnectedPlug, ...) error
- func (spec *Specification) AddConnectedSlot(iface interfaces.Interface, plug *interfaces.ConnectedPlug, ...) error
- func (spec *Specification) AddPermanentPlug(iface interfaces.Interface, plug *sdk.PlugInfo) error
- func (spec *Specification) AddPermanentSlot(iface interfaces.Interface, slot *sdk.SlotInfo) error
- func (spec *Specification) AddSnippet(snippet string)
- type TestInterface
- func (t *TestInterface) AutoConnect(plug *sdk.PlugInfo, slot *sdk.SlotInfo) bool
- func (t *TestInterface) BeforeConnectPlug(plug *interfaces.ConnectedPlug) error
- func (t *TestInterface) BeforeConnectSlot(slot *interfaces.ConnectedSlot) error
- func (t *TestInterface) BeforePreparePlug(plug *sdk.PlugInfo) error
- func (t *TestInterface) BeforePrepareSlot(slot *sdk.SlotInfo) error
- func (t *TestInterface) Name() string
- func (t *TestInterface) StaticInfo() interfaces.StaticInfo
- func (t *TestInterface) String() string
- func (t *TestInterface) TestConnectedPlug(spec *Specification, plug *interfaces.ConnectedPlug, ...) error
- func (t *TestInterface) TestConnectedSlot(spec *Specification, plug *interfaces.ConnectedPlug, ...) error
- func (t *TestInterface) TestPermanentPlug(spec *Specification, plug *sdk.PlugInfo) error
- func (t *TestInterface) TestPermanentSlot(spec *Specification, slot *sdk.SlotInfo) error
- type TestSecurityBackend
- func (b *TestSecurityBackend) Initialize() error
- func (b *TestSecurityBackend) Name() interfaces.SecuritySystem
- func (b *TestSecurityBackend) NewSpecification(user string, sdk string) (interfaces.Specification, error)
- func (b *TestSecurityBackend) Remove(context context.Context, sdkRef sdk.Ref) error
- func (b *TestSecurityBackend) SandboxFeatures() []string
- func (b *TestSecurityBackend) Setup(context context.Context, sdkRef sdk.Ref, repo *interfaces.Repository) error
- type TestSetupCall
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateTestContext ¶
Types ¶
type Specification ¶
type Specification struct {
Snippets []string
// contains filtered or unexported fields
}
Specification is a specification intended for testing.
func (*Specification) AddConnectedPlug ¶
func (spec *Specification) AddConnectedPlug(iface interfaces.Interface, plug *interfaces.ConnectedPlug, slot *interfaces.ConnectedSlot) error
AddConnectedPlug records test side-effects of having a connected plug.
func (*Specification) AddConnectedSlot ¶
func (spec *Specification) AddConnectedSlot(iface interfaces.Interface, plug *interfaces.ConnectedPlug, slot *interfaces.ConnectedSlot) error
AddConnectedSlot records test side-effects of having a connected slot.
func (*Specification) AddPermanentPlug ¶
func (spec *Specification) AddPermanentPlug(iface interfaces.Interface, plug *sdk.PlugInfo) error
AddPermanentPlug records test side-effects of having a plug.
func (*Specification) AddPermanentSlot ¶
func (spec *Specification) AddPermanentSlot(iface interfaces.Interface, slot *sdk.SlotInfo) error
AddPermanentSlot records test side-effects of having a slot.
func (*Specification) AddSnippet ¶
func (spec *Specification) AddSnippet(snippet string)
AddSnippet appends a snippet to a list stored in the specification.
type TestInterface ¶
type TestInterface struct {
// InterfaceName is the name of this interface
InterfaceName string
InterfaceStaticInfo interfaces.StaticInfo
// AutoConnectCallback is the callback invoked inside AutoConnect
AutoConnectCallback func(*sdk.PlugInfo, *sdk.SlotInfo) bool
// BeforePreparePlugCallback is the callback invoked inside BeforePreparePlug()
BeforePreparePlugCallback func(plug *sdk.PlugInfo) error
// BeforePrepareSlotCallback is the callback invoked inside BeforePrepareSlot()
BeforePrepareSlotCallback func(slot *sdk.SlotInfo) error
BeforeConnectPlugCallback func(plug *interfaces.ConnectedPlug) error
BeforeConnectSlotCallback func(slot *interfaces.ConnectedSlot) error
// Support for interacting with the test backend.
TestConnectedPlugCallback func(spec *Specification, plug *interfaces.ConnectedPlug, slot *interfaces.ConnectedSlot) error
TestConnectedSlotCallback func(spec *Specification, plug *interfaces.ConnectedPlug, slot *interfaces.ConnectedSlot) error
TestPermanentPlugCallback func(spec *Specification, plug *sdk.PlugInfo) error
TestPermanentSlotCallback func(spec *Specification, slot *sdk.SlotInfo) error
}
TestInterface is a interface for various kind of tests. It is public so that it can be consumed from other packages.
func (*TestInterface) AutoConnect ¶
func (*TestInterface) BeforeConnectPlug ¶
func (t *TestInterface) BeforeConnectPlug(plug *interfaces.ConnectedPlug) error
func (*TestInterface) BeforeConnectSlot ¶
func (t *TestInterface) BeforeConnectSlot(slot *interfaces.ConnectedSlot) error
func (*TestInterface) BeforePreparePlug ¶
func (t *TestInterface) BeforePreparePlug(plug *sdk.PlugInfo) error
BeforePreparePlug checks and possibly modifies a plug.
func (*TestInterface) BeforePrepareSlot ¶
func (t *TestInterface) BeforePrepareSlot(slot *sdk.SlotInfo) error
BeforePrepareSlot checks and possibly modifies a slot.
func (*TestInterface) Name ¶
func (t *TestInterface) Name() string
Name returns the name of the test interface.
func (*TestInterface) StaticInfo ¶
func (t *TestInterface) StaticInfo() interfaces.StaticInfo
func (*TestInterface) String ¶
func (t *TestInterface) String() string
func (*TestInterface) TestConnectedPlug ¶
func (t *TestInterface) TestConnectedPlug(spec *Specification, plug *interfaces.ConnectedPlug, slot *interfaces.ConnectedSlot) error
func (*TestInterface) TestConnectedSlot ¶
func (t *TestInterface) TestConnectedSlot(spec *Specification, plug *interfaces.ConnectedPlug, slot *interfaces.ConnectedSlot) error
func (*TestInterface) TestPermanentPlug ¶
func (t *TestInterface) TestPermanentPlug(spec *Specification, plug *sdk.PlugInfo) error
func (*TestInterface) TestPermanentSlot ¶
func (t *TestInterface) TestPermanentSlot(spec *Specification, slot *sdk.SlotInfo) error
type TestSecurityBackend ¶
type TestSecurityBackend struct {
BackendName interfaces.SecuritySystem
// SetupCalls stores information about all calls to Setup
SetupCalls []TestSetupCall
// RemoveCalls stores information about all calls to Remove
RemoveCalls []string
// SetupCallback is an callback that is optionally called in Setup
SetupCallback func(context context.Context, sdkRef sdk.Ref, repo *interfaces.Repository) error
// RemoveCallback is a callback that is optionally called in Remove
RemoveCallback func(sdkName string) error
// SandboxFeaturesCallback is a callback that is optionally called in SandboxFeatures
SandboxFeaturesCallback func() []string
// contains filtered or unexported fields
}
TestSecurityBackend is a security backend intended for testing.
func (*TestSecurityBackend) Initialize ¶
func (b *TestSecurityBackend) Initialize() error
Initialize does nothing.
func (*TestSecurityBackend) Name ¶
func (b *TestSecurityBackend) Name() interfaces.SecuritySystem
Name returns the name of the security backend.
func (*TestSecurityBackend) NewSpecification ¶
func (b *TestSecurityBackend) NewSpecification(user string, sdk string) (interfaces.Specification, error)
func (*TestSecurityBackend) Remove ¶
Remove records information about the call and calls the remove callback if one is defined
func (*TestSecurityBackend) SandboxFeatures ¶
func (b *TestSecurityBackend) SandboxFeatures() []string
func (*TestSecurityBackend) Setup ¶
func (b *TestSecurityBackend) Setup(context context.Context, sdkRef sdk.Ref, repo *interfaces.Repository) error
Setup records information about the call and calls the setup callback if one is defined.
type TestSetupCall ¶
type TestSetupCall struct {
// SdkInfo is a copy of the sdkRef argument to a particular call to Setup
SdkRef sdk.Ref
}
TestSetupCall stores details about calls to TestSecurityBackend.Setup