Documentation ¶
Index ¶
- type Alias
- type AliasMock
- func (mock *AliasMock) GetCommand() string
- func (mock *AliasMock) GetCommandCalls() []struct{}
- func (mock *AliasMock) GetDescription() string
- func (mock *AliasMock) GetDescriptionCalls() []struct{}
- func (mock *AliasMock) GetName() string
- func (mock *AliasMock) GetNameCalls() []struct{}
- func (mock *AliasMock) IsShell() bool
- func (mock *AliasMock) IsShellCalls() []struct{}
- type Command
- type ExtTemplateType
- type Extension
- type ExtensionManager
- type ExtensionManagerMock
- func (mock *ExtensionManagerMock) Create(name string, tmplType ExtTemplateType) error
- func (mock *ExtensionManagerMock) CreateCalls() []struct{ ... }
- func (mock *ExtensionManagerMock) Dispatch(args []string, stdin io.Reader, stdout io.Writer, stderr io.Writer) (bool, error)
- func (mock *ExtensionManagerMock) DispatchCalls() []struct{ ... }
- func (mock *ExtensionManagerMock) EnableDryRunMode()
- func (mock *ExtensionManagerMock) EnableDryRunModeCalls() []struct{}
- func (mock *ExtensionManagerMock) Execute(exe string, args []string, isBinary bool, stdin io.Reader, stdout io.Writer, ...) (bool, error)
- func (mock *ExtensionManagerMock) ExecuteCalls() []struct{ ... }
- func (mock *ExtensionManagerMock) Install(interfaceMoqParam ghrepo.Interface, s1 string, s2 string) error
- func (mock *ExtensionManagerMock) InstallCalls() []struct{ ... }
- func (mock *ExtensionManagerMock) InstallLocal(dir string, name string) error
- func (mock *ExtensionManagerMock) InstallLocalCalls() []struct{ ... }
- func (mock *ExtensionManagerMock) List() []Extension
- func (mock *ExtensionManagerMock) ListCalls() []struct{}
- func (mock *ExtensionManagerMock) Remove(name string) error
- func (mock *ExtensionManagerMock) RemoveCalls() []struct{ ... }
- func (mock *ExtensionManagerMock) Upgrade(name string, force bool) error
- func (mock *ExtensionManagerMock) UpgradeCalls() []struct{ ... }
- type ExtensionMock
- func (mock *ExtensionMock) Aliases() ([]Alias, error)
- func (mock *ExtensionMock) AliasesCalls() []struct{}
- func (mock *ExtensionMock) Commands() ([]Command, error)
- func (mock *ExtensionMock) CommandsCalls() []struct{}
- func (mock *ExtensionMock) CurrentVersion() string
- func (mock *ExtensionMock) CurrentVersionCalls() []struct{}
- func (mock *ExtensionMock) IsBinary() bool
- func (mock *ExtensionMock) IsBinaryCalls() []struct{}
- func (mock *ExtensionMock) IsLocal() bool
- func (mock *ExtensionMock) IsLocalCalls() []struct{}
- func (mock *ExtensionMock) IsPinned() bool
- func (mock *ExtensionMock) IsPinnedCalls() []struct{}
- func (mock *ExtensionMock) Name() string
- func (mock *ExtensionMock) NameCalls() []struct{}
- func (mock *ExtensionMock) Path() string
- func (mock *ExtensionMock) PathCalls() []struct{}
- func (mock *ExtensionMock) TemplatePath() string
- func (mock *ExtensionMock) TemplatePathCalls() []struct{}
- func (mock *ExtensionMock) URL() string
- func (mock *ExtensionMock) URLCalls() []struct{}
- func (mock *ExtensionMock) UpdateAvailable() bool
- func (mock *ExtensionMock) UpdateAvailableCalls() []struct{}
- func (mock *ExtensionMock) ViewPath() string
- func (mock *ExtensionMock) ViewPathCalls() []struct{}
- type Template
- type View
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AliasMock ¶
type AliasMock struct { // GetCommandFunc mocks the GetCommand method. GetCommandFunc func() string // GetDescriptionFunc mocks the GetDescription method. GetDescriptionFunc func() string // GetNameFunc mocks the GetName method. GetNameFunc func() string // IsShellFunc mocks the IsShell method. IsShellFunc func() bool // contains filtered or unexported fields }
AliasMock is a mock implementation of Alias.
func TestSomethingThatUsesAlias(t *testing.T) { // make and configure a mocked Alias mockedAlias := &AliasMock{ GetCommandFunc: func() string { panic("mock out the GetCommand method") }, GetDescriptionFunc: func() string { panic("mock out the GetDescription method") }, GetNameFunc: func() string { panic("mock out the GetName method") }, IsShellFunc: func() bool { panic("mock out the IsShell method") }, } // use mockedAlias in code that requires Alias // and then make assertions. }
func (*AliasMock) GetCommand ¶
GetCommand calls GetCommandFunc.
func (*AliasMock) GetCommandCalls ¶
func (mock *AliasMock) GetCommandCalls() []struct { }
GetCommandCalls gets all the calls that were made to GetCommand. Check the length with:
len(mockedAlias.GetCommandCalls())
func (*AliasMock) GetDescription ¶
GetDescription calls GetDescriptionFunc.
func (*AliasMock) GetDescriptionCalls ¶
func (mock *AliasMock) GetDescriptionCalls() []struct { }
GetDescriptionCalls gets all the calls that were made to GetDescription. Check the length with:
len(mockedAlias.GetDescriptionCalls())
func (*AliasMock) GetNameCalls ¶
func (mock *AliasMock) GetNameCalls() []struct { }
GetNameCalls gets all the calls that were made to GetName. Check the length with:
len(mockedAlias.GetNameCalls())
func (*AliasMock) IsShellCalls ¶
func (mock *AliasMock) IsShellCalls() []struct { }
IsShellCalls gets all the calls that were made to IsShell. Check the length with:
len(mockedAlias.IsShellCalls())
type ExtTemplateType ¶
type ExtTemplateType int
const ( GitTemplateType ExtTemplateType = 0 GoBinTemplateType ExtTemplateType = 1 OtherBinTemplateType ExtTemplateType = 2 )
type Extension ¶
type Extension interface { Name() string // Extension Name without c8y- Path() string // Path to executable URL() string CurrentVersion() string IsPinned() bool UpdateAvailable() bool IsBinary() bool IsLocal() bool // Extension components TemplatePath() string ViewPath() string Aliases() ([]Alias, error) Commands() ([]Command, error) }
type ExtensionManager ¶
type ExtensionManager interface { List() []Extension Install(ghrepo.Interface, string, string) error InstallLocal(dir string, name string) error Upgrade(name string, force bool) error Remove(name string) error Dispatch(args []string, stdin io.Reader, stdout, stderr io.Writer) (bool, error) Execute(exe string, args []string, isBinary bool, stdin io.Reader, stdout, stderr io.Writer) (bool, error) Create(name string, tmplType ExtTemplateType) error EnableDryRunMode() }
type ExtensionManagerMock ¶
type ExtensionManagerMock struct { // CreateFunc mocks the Create method. CreateFunc func(name string, tmplType ExtTemplateType) error // DispatchFunc mocks the Dispatch method. DispatchFunc func(args []string, stdin io.Reader, stdout io.Writer, stderr io.Writer) (bool, error) // EnableDryRunModeFunc mocks the EnableDryRunMode method. EnableDryRunModeFunc func() // ExecuteFunc mocks the Execute method. ExecuteFunc func(exe string, args []string, isBinary bool, stdin io.Reader, stdout io.Writer, stderr io.Writer) (bool, error) // InstallFunc mocks the Install method. InstallFunc func(interfaceMoqParam ghrepo.Interface, s1 string, s2 string) error // InstallLocalFunc mocks the InstallLocal method. InstallLocalFunc func(dir string, name string) error // ListFunc mocks the List method. ListFunc func() []Extension // RemoveFunc mocks the Remove method. RemoveFunc func(name string) error // UpgradeFunc mocks the Upgrade method. UpgradeFunc func(name string, force bool) error // contains filtered or unexported fields }
ExtensionManagerMock is a mock implementation of ExtensionManager.
func TestSomethingThatUsesExtensionManager(t *testing.T) { // make and configure a mocked ExtensionManager mockedExtensionManager := &ExtensionManagerMock{ CreateFunc: func(name string, tmplType ExtTemplateType) error { panic("mock out the Create method") }, DispatchFunc: func(args []string, stdin io.Reader, stdout io.Writer, stderr io.Writer) (bool, error) { panic("mock out the Dispatch method") }, EnableDryRunModeFunc: func() { panic("mock out the EnableDryRunMode method") }, ExecuteFunc: func(exe string, args []string, isBinary bool, stdin io.Reader, stdout io.Writer, stderr io.Writer) (bool, error) { panic("mock out the Execute method") }, InstallFunc: func(interfaceMoqParam ghrepo.Interface, s1 string, s2 string) error { panic("mock out the Install method") }, InstallLocalFunc: func(dir string, name string) error { panic("mock out the InstallLocal method") }, ListFunc: func() []Extension { panic("mock out the List method") }, RemoveFunc: func(name string) error { panic("mock out the Remove method") }, UpgradeFunc: func(name string, force bool) error { panic("mock out the Upgrade method") }, } // use mockedExtensionManager in code that requires ExtensionManager // and then make assertions. }
func (*ExtensionManagerMock) Create ¶
func (mock *ExtensionManagerMock) Create(name string, tmplType ExtTemplateType) error
Create calls CreateFunc.
func (*ExtensionManagerMock) CreateCalls ¶
func (mock *ExtensionManagerMock) CreateCalls() []struct { Name string TmplType ExtTemplateType }
CreateCalls gets all the calls that were made to Create. Check the length with:
len(mockedExtensionManager.CreateCalls())
func (*ExtensionManagerMock) Dispatch ¶
func (mock *ExtensionManagerMock) Dispatch(args []string, stdin io.Reader, stdout io.Writer, stderr io.Writer) (bool, error)
Dispatch calls DispatchFunc.
func (*ExtensionManagerMock) DispatchCalls ¶
func (mock *ExtensionManagerMock) DispatchCalls() []struct { Args []string Stdin io.Reader Stdout io.Writer Stderr io.Writer }
DispatchCalls gets all the calls that were made to Dispatch. Check the length with:
len(mockedExtensionManager.DispatchCalls())
func (*ExtensionManagerMock) EnableDryRunMode ¶
func (mock *ExtensionManagerMock) EnableDryRunMode()
EnableDryRunMode calls EnableDryRunModeFunc.
func (*ExtensionManagerMock) EnableDryRunModeCalls ¶
func (mock *ExtensionManagerMock) EnableDryRunModeCalls() []struct { }
EnableDryRunModeCalls gets all the calls that were made to EnableDryRunMode. Check the length with:
len(mockedExtensionManager.EnableDryRunModeCalls())
func (*ExtensionManagerMock) Execute ¶
func (mock *ExtensionManagerMock) Execute(exe string, args []string, isBinary bool, stdin io.Reader, stdout io.Writer, stderr io.Writer) (bool, error)
Execute calls ExecuteFunc.
func (*ExtensionManagerMock) ExecuteCalls ¶
func (mock *ExtensionManagerMock) ExecuteCalls() []struct { Exe string Args []string IsBinary bool Stdin io.Reader Stdout io.Writer Stderr io.Writer }
ExecuteCalls gets all the calls that were made to Execute. Check the length with:
len(mockedExtensionManager.ExecuteCalls())
func (*ExtensionManagerMock) Install ¶
func (mock *ExtensionManagerMock) Install(interfaceMoqParam ghrepo.Interface, s1 string, s2 string) error
Install calls InstallFunc.
func (*ExtensionManagerMock) InstallCalls ¶
func (mock *ExtensionManagerMock) InstallCalls() []struct { InterfaceMoqParam ghrepo.Interface S1 string S2 string }
InstallCalls gets all the calls that were made to Install. Check the length with:
len(mockedExtensionManager.InstallCalls())
func (*ExtensionManagerMock) InstallLocal ¶
func (mock *ExtensionManagerMock) InstallLocal(dir string, name string) error
InstallLocal calls InstallLocalFunc.
func (*ExtensionManagerMock) InstallLocalCalls ¶
func (mock *ExtensionManagerMock) InstallLocalCalls() []struct { Dir string Name string }
InstallLocalCalls gets all the calls that were made to InstallLocal. Check the length with:
len(mockedExtensionManager.InstallLocalCalls())
func (*ExtensionManagerMock) List ¶
func (mock *ExtensionManagerMock) List() []Extension
List calls ListFunc.
func (*ExtensionManagerMock) ListCalls ¶
func (mock *ExtensionManagerMock) ListCalls() []struct { }
ListCalls gets all the calls that were made to List. Check the length with:
len(mockedExtensionManager.ListCalls())
func (*ExtensionManagerMock) Remove ¶
func (mock *ExtensionManagerMock) Remove(name string) error
Remove calls RemoveFunc.
func (*ExtensionManagerMock) RemoveCalls ¶
func (mock *ExtensionManagerMock) RemoveCalls() []struct { Name string }
RemoveCalls gets all the calls that were made to Remove. Check the length with:
len(mockedExtensionManager.RemoveCalls())
func (*ExtensionManagerMock) Upgrade ¶
func (mock *ExtensionManagerMock) Upgrade(name string, force bool) error
Upgrade calls UpgradeFunc.
func (*ExtensionManagerMock) UpgradeCalls ¶
func (mock *ExtensionManagerMock) UpgradeCalls() []struct { Name string Force bool }
UpgradeCalls gets all the calls that were made to Upgrade. Check the length with:
len(mockedExtensionManager.UpgradeCalls())
type ExtensionMock ¶
type ExtensionMock struct { // AliasesFunc mocks the Aliases method. AliasesFunc func() ([]Alias, error) // CommandsFunc mocks the Commands method. CommandsFunc func() ([]Command, error) // CurrentVersionFunc mocks the CurrentVersion method. CurrentVersionFunc func() string // IsBinaryFunc mocks the IsBinary method. IsBinaryFunc func() bool // IsLocalFunc mocks the IsLocal method. IsLocalFunc func() bool // IsPinnedFunc mocks the IsPinned method. IsPinnedFunc func() bool // NameFunc mocks the Name method. NameFunc func() string // PathFunc mocks the Path method. PathFunc func() string // TemplatePathFunc mocks the TemplatePath method. TemplatePathFunc func() string // URLFunc mocks the URL method. URLFunc func() string // UpdateAvailableFunc mocks the UpdateAvailable method. UpdateAvailableFunc func() bool // ViewPathFunc mocks the ViewPath method. ViewPathFunc func() string // contains filtered or unexported fields }
ExtensionMock is a mock implementation of Extension.
func TestSomethingThatUsesExtension(t *testing.T) { // make and configure a mocked Extension mockedExtension := &ExtensionMock{ AliasesFunc: func() ([]Alias, error) { panic("mock out the Aliases method") }, CommandsFunc: func() ([]Command, error) { panic("mock out the Commands method") }, CurrentVersionFunc: func() string { panic("mock out the CurrentVersion method") }, IsBinaryFunc: func() bool { panic("mock out the IsBinary method") }, IsLocalFunc: func() bool { panic("mock out the IsLocal method") }, IsPinnedFunc: func() bool { panic("mock out the IsPinned method") }, NameFunc: func() string { panic("mock out the Name method") }, PathFunc: func() string { panic("mock out the Path method") }, TemplatePathFunc: func() string { panic("mock out the TemplatePath method") }, URLFunc: func() string { panic("mock out the URL method") }, UpdateAvailableFunc: func() bool { panic("mock out the UpdateAvailable method") }, ViewPathFunc: func() string { panic("mock out the ViewPath method") }, } // use mockedExtension in code that requires Extension // and then make assertions. }
func (*ExtensionMock) Aliases ¶
func (mock *ExtensionMock) Aliases() ([]Alias, error)
Aliases calls AliasesFunc.
func (*ExtensionMock) AliasesCalls ¶
func (mock *ExtensionMock) AliasesCalls() []struct { }
AliasesCalls gets all the calls that were made to Aliases. Check the length with:
len(mockedExtension.AliasesCalls())
func (*ExtensionMock) Commands ¶
func (mock *ExtensionMock) Commands() ([]Command, error)
Commands calls CommandsFunc.
func (*ExtensionMock) CommandsCalls ¶
func (mock *ExtensionMock) CommandsCalls() []struct { }
CommandsCalls gets all the calls that were made to Commands. Check the length with:
len(mockedExtension.CommandsCalls())
func (*ExtensionMock) CurrentVersion ¶
func (mock *ExtensionMock) CurrentVersion() string
CurrentVersion calls CurrentVersionFunc.
func (*ExtensionMock) CurrentVersionCalls ¶
func (mock *ExtensionMock) CurrentVersionCalls() []struct { }
CurrentVersionCalls gets all the calls that were made to CurrentVersion. Check the length with:
len(mockedExtension.CurrentVersionCalls())
func (*ExtensionMock) IsBinary ¶
func (mock *ExtensionMock) IsBinary() bool
IsBinary calls IsBinaryFunc.
func (*ExtensionMock) IsBinaryCalls ¶
func (mock *ExtensionMock) IsBinaryCalls() []struct { }
IsBinaryCalls gets all the calls that were made to IsBinary. Check the length with:
len(mockedExtension.IsBinaryCalls())
func (*ExtensionMock) IsLocal ¶
func (mock *ExtensionMock) IsLocal() bool
IsLocal calls IsLocalFunc.
func (*ExtensionMock) IsLocalCalls ¶
func (mock *ExtensionMock) IsLocalCalls() []struct { }
IsLocalCalls gets all the calls that were made to IsLocal. Check the length with:
len(mockedExtension.IsLocalCalls())
func (*ExtensionMock) IsPinned ¶
func (mock *ExtensionMock) IsPinned() bool
IsPinned calls IsPinnedFunc.
func (*ExtensionMock) IsPinnedCalls ¶
func (mock *ExtensionMock) IsPinnedCalls() []struct { }
IsPinnedCalls gets all the calls that were made to IsPinned. Check the length with:
len(mockedExtension.IsPinnedCalls())
func (*ExtensionMock) NameCalls ¶
func (mock *ExtensionMock) NameCalls() []struct { }
NameCalls gets all the calls that were made to Name. Check the length with:
len(mockedExtension.NameCalls())
func (*ExtensionMock) PathCalls ¶
func (mock *ExtensionMock) PathCalls() []struct { }
PathCalls gets all the calls that were made to Path. Check the length with:
len(mockedExtension.PathCalls())
func (*ExtensionMock) TemplatePath ¶
func (mock *ExtensionMock) TemplatePath() string
TemplatePath calls TemplatePathFunc.
func (*ExtensionMock) TemplatePathCalls ¶
func (mock *ExtensionMock) TemplatePathCalls() []struct { }
TemplatePathCalls gets all the calls that were made to TemplatePath. Check the length with:
len(mockedExtension.TemplatePathCalls())
func (*ExtensionMock) URLCalls ¶
func (mock *ExtensionMock) URLCalls() []struct { }
URLCalls gets all the calls that were made to URL. Check the length with:
len(mockedExtension.URLCalls())
func (*ExtensionMock) UpdateAvailable ¶
func (mock *ExtensionMock) UpdateAvailable() bool
UpdateAvailable calls UpdateAvailableFunc.
func (*ExtensionMock) UpdateAvailableCalls ¶
func (mock *ExtensionMock) UpdateAvailableCalls() []struct { }
UpdateAvailableCalls gets all the calls that were made to UpdateAvailable. Check the length with:
len(mockedExtension.UpdateAvailableCalls())
func (*ExtensionMock) ViewPath ¶
func (mock *ExtensionMock) ViewPath() string
ViewPath calls ViewPathFunc.
func (*ExtensionMock) ViewPathCalls ¶
func (mock *ExtensionMock) ViewPathCalls() []struct { }
ViewPathCalls gets all the calls that were made to ViewPath. Check the length with:
len(mockedExtension.ViewPathCalls())