extensions

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2021 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCmdExtensions

func NewCmdExtensions(f *cmdutil.Factory) *cobra.Command

Types

type Extension

type Extension struct {
	// contains filtered or unexported fields
}

func (*Extension) Name

func (e *Extension) Name() string

func (*Extension) Path

func (e *Extension) Path() string

func (*Extension) URL

func (e *Extension) URL() string

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, 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, 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) Install

func (mock *ExtensionManagerMock) Install(url string, stdout io.Writer, stderr io.Writer) error

Install calls InstallFunc.

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, stdout io.Writer, stderr io.Writer) error

Upgrade calls UpgradeFunc.

func (*ExtensionManagerMock) UpgradeCalls

func (mock *ExtensionManagerMock) UpgradeCalls() []struct {
	Name   string
	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 {
	// NameFunc mocks the Name method.
	NameFunc func() string

	// PathFunc mocks the Path method.
	PathFunc func() string

	// URLFunc mocks the URL method.
	URLFunc 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{
		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")
		},
	}

	// use mockedExtension in code that requires Extension
	// and then make assertions.

}

func (*ExtensionMock) Name

func (mock *ExtensionMock) Name() string

Name calls NameFunc.

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) Path

func (mock *ExtensionMock) Path() string

Path calls PathFunc.

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) URL

func (mock *ExtensionMock) URL() string

URL calls URLFunc.

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())

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

func NewManager

func NewManager() *Manager

func (*Manager) Dispatch

func (m *Manager) Dispatch(args []string, stdin io.Reader, stdout, stderr io.Writer) (bool, error)

func (*Manager) Install

func (m *Manager) Install(cloneURL string, stdout, stderr io.Writer) error

func (*Manager) InstallLocal

func (m *Manager) InstallLocal(dir string) error

func (*Manager) List

func (m *Manager) List() []extensions.Extension

func (*Manager) Remove

func (m *Manager) Remove(name string) error

func (*Manager) Upgrade

func (m *Manager) Upgrade(name string, stdout, stderr io.Writer) error

Jump to

Keyboard shortcuts

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