Documentation
¶
Index ¶
- type Extension
- type ExtensionManager
- type ExtensionManagerMock
- 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) Install(url string, stdout io.Writer, stderr io.Writer) error
- func (mock *ExtensionManagerMock) InstallCalls() []struct{ ... }
- func (mock *ExtensionManagerMock) InstallLocal(dir 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, stdout io.Writer, stderr io.Writer) error
- func (mock *ExtensionManagerMock) UpgradeCalls() []struct{ ... }
- type ExtensionMock
- func (mock *ExtensionMock) IsLocal() bool
- func (mock *ExtensionMock) IsLocalCalls() []struct{}
- func (mock *ExtensionMock) Name() string
- func (mock *ExtensionMock) NameCalls() []struct{}
- func (mock *ExtensionMock) Path() string
- func (mock *ExtensionMock) PathCalls() []struct{}
- func (mock *ExtensionMock) URL() string
- func (mock *ExtensionMock) URLCalls() []struct{}
- func (mock *ExtensionMock) UpdateAvailable() bool
- func (mock *ExtensionMock) UpdateAvailableCalls() []struct{}
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ExtensionManager ¶
type ExtensionManager interface {
List() []Extension
Install(url string, stdout, stderr io.Writer) error
InstallLocal(dir string) error
Upgrade(name string, force bool, stdout, stderr io.Writer) error
Remove(name string) error
Dispatch(args []string, stdin io.Reader, stdout, stderr io.Writer) (bool, error)
}
type ExtensionManagerMock ¶
type ExtensionManagerMock struct {
// DispatchFunc mocks the Dispatch method.
DispatchFunc func(args []string, stdin io.Reader, stdout io.Writer, stderr io.Writer) (bool, error)
// InstallFunc mocks the Install method.
InstallFunc func(url string, stdout io.Writer, stderr io.Writer) error
// InstallLocalFunc mocks the InstallLocal method.
InstallLocalFunc func(dir 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, stdout io.Writer, stderr io.Writer) 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{
DispatchFunc: func(args []string, stdin io.Reader, stdout io.Writer, stderr io.Writer) (bool, error) {
panic("mock out the Dispatch method")
},
InstallFunc: func(url string, stdout io.Writer, stderr io.Writer) error {
panic("mock out the Install method")
},
InstallLocalFunc: func(dir 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, stdout io.Writer, stderr io.Writer) error {
panic("mock out the Upgrade method")
},
}
// use mockedExtensionManager in code that requires ExtensionManager
// and then make assertions.
}
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) InstallCalls ¶
func (mock *ExtensionManagerMock) InstallCalls() []struct { URL string Stdout io.Writer Stderr io.Writer }
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) error
InstallLocal calls InstallLocalFunc.
func (*ExtensionManagerMock) InstallLocalCalls ¶
func (mock *ExtensionManagerMock) InstallLocalCalls() []struct { Dir 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, stdout io.Writer, stderr io.Writer) error
Upgrade calls UpgradeFunc.
func (*ExtensionManagerMock) UpgradeCalls ¶
func (mock *ExtensionManagerMock) UpgradeCalls() []struct { Name string Force bool Stdout io.Writer Stderr io.Writer }
UpgradeCalls gets all the calls that were made to Upgrade. Check the length with:
len(mockedExtensionManager.UpgradeCalls())
type ExtensionMock ¶
type ExtensionMock struct {
// IsLocalFunc mocks the IsLocal method.
IsLocalFunc func() bool
// NameFunc mocks the Name method.
NameFunc func() string
// PathFunc mocks the Path method.
PathFunc func() string
// URLFunc mocks the URL method.
URLFunc func() string
// UpdateAvailableFunc mocks the UpdateAvailable method.
UpdateAvailableFunc func() bool
// 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{
IsLocalFunc: func() bool {
panic("mock out the IsLocal method")
},
NameFunc: func() string {
panic("mock out the Name method")
},
PathFunc: func() string {
panic("mock out the Path method")
},
URLFunc: func() string {
panic("mock out the URL method")
},
UpdateAvailableFunc: func() bool {
panic("mock out the UpdateAvailable method")
},
}
// use mockedExtension in code that requires Extension
// and then make assertions.
}
func (*ExtensionMock) IsLocal ¶ added in v1.13.0
func (mock *ExtensionMock) IsLocal() bool
IsLocal calls IsLocalFunc.
func (*ExtensionMock) IsLocalCalls ¶ added in v1.13.0
func (mock *ExtensionMock) IsLocalCalls() []struct { }
IsLocalCalls gets all the calls that were made to IsLocal. Check the length with:
len(mockedExtension.IsLocalCalls())
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) 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 ¶ added in v1.14.0
func (mock *ExtensionMock) UpdateAvailable() bool
UpdateAvailable calls UpdateAvailableFunc.
func (*ExtensionMock) UpdateAvailableCalls ¶ added in v1.14.0
func (mock *ExtensionMock) UpdateAvailableCalls() []struct { }
UpdateAvailableCalls gets all the calls that were made to UpdateAvailable. Check the length with:
len(mockedExtension.UpdateAvailableCalls())