Documentation ¶
Overview ¶
Package test is a test-only package that can be used by other cli package to write unit test.
It as an internal package and cannot be used outside of github.com/docker/cli package.
Index ¶
- func EnableContentTrust(c *FakeCli)
- func NewFakeStore() credentials.Store
- type FakeCli
- func (c *FakeCli) Client() client.APIClient
- func (c *FakeCli) ClientInfo() command.ClientInfo
- func (c *FakeCli) ConfigFile() *configfile.ConfigFile
- func (c *FakeCli) ContentTrustEnabled() bool
- func (c *FakeCli) Err() io.Writer
- func (c *FakeCli) ErrBuffer() *bytes.Buffer
- func (c *FakeCli) In() *command.InStream
- func (c *FakeCli) ManifestStore() manifeststore.Store
- func (c *FakeCli) NewContainerizedEngineClient(sockPath string) (clitypes.ContainerizedClient, error)
- func (c *FakeCli) NotaryClient(imgRefAndAuth trust.ImageRefAndAuth, actions []string) (notaryclient.Repository, error)
- func (c *FakeCli) Out() *command.OutStream
- func (c *FakeCli) OutBuffer() *bytes.Buffer
- func (c *FakeCli) RegistryClient(insecure bool) registryclient.RegistryClient
- func (c *FakeCli) ServerInfo() command.ServerInfo
- func (c *FakeCli) SetClientInfo(clientInfoFunc clientInfoFuncType)
- func (c *FakeCli) SetConfigFile(configfile *configfile.ConfigFile)
- func (c *FakeCli) SetContainerizedEngineClient(containerizedEngineClientFunc containerizedEngineFuncType)
- func (c *FakeCli) SetErr(err *bytes.Buffer)
- func (c *FakeCli) SetIn(in *command.InStream)
- func (c *FakeCli) SetManifestStore(store manifeststore.Store)
- func (c *FakeCli) SetNotaryClient(notaryClientFunc NotaryClientFuncType)
- func (c *FakeCli) SetRegistryClient(client registryclient.RegistryClient)
- type FakeStore
- func (c *FakeStore) Erase(serverAddress string) error
- func (c *FakeStore) Get(serverAddress string) (types.AuthConfig, error)
- func (c *FakeStore) GetAll() (map[string]types.AuthConfig, error)
- func (c *FakeStore) SetEraseFunc(eraseFunc func(string) error)
- func (c *FakeStore) SetGetAllFunc(getAllFunc func() (map[string]types.AuthConfig, error))
- func (c *FakeStore) SetGetFunc(getFunc func(string) (types.AuthConfig, error))
- func (c *FakeStore) SetStore(store map[string]types.AuthConfig)
- func (c *FakeStore) SetStoreFunc(storeFunc func(types.AuthConfig) error)
- func (c *FakeStore) Store(authConfig types.AuthConfig) error
- type NotaryClientFuncType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewFakeStore ¶
func NewFakeStore() credentials.Store
NewFakeStore creates a new file credentials store.
Types ¶
type FakeCli ¶
FakeCli emulates the default DockerCli
func NewFakeCli ¶
NewFakeCli returns a fake for the command.Cli interface
func (*FakeCli) ClientInfo ¶
func (c *FakeCli) ClientInfo() command.ClientInfo
ClientInfo returns client information
func (*FakeCli) ConfigFile ¶
func (c *FakeCli) ConfigFile() *configfile.ConfigFile
ConfigFile returns the cli configfile object (to get client configuration)
func (*FakeCli) ContentTrustEnabled ¶
ContentTrustEnabled on the fake cli
func (*FakeCli) ManifestStore ¶
func (c *FakeCli) ManifestStore() manifeststore.Store
ManifestStore returns a fake store used for testing
func (*FakeCli) NewContainerizedEngineClient ¶
func (c *FakeCli) NewContainerizedEngineClient(sockPath string) (clitypes.ContainerizedClient, error)
NewContainerizedEngineClient returns a containerized engine client
func (*FakeCli) NotaryClient ¶
func (c *FakeCli) NotaryClient(imgRefAndAuth trust.ImageRefAndAuth, actions []string) (notaryclient.Repository, error)
NotaryClient returns an err for testing unless defined
func (*FakeCli) RegistryClient ¶
func (c *FakeCli) RegistryClient(insecure bool) registryclient.RegistryClient
RegistryClient returns a fake client for testing
func (*FakeCli) ServerInfo ¶
func (c *FakeCli) ServerInfo() command.ServerInfo
ServerInfo returns API server information for the server used by this client
func (*FakeCli) SetClientInfo ¶
func (c *FakeCli) SetClientInfo(clientInfoFunc clientInfoFuncType)
SetClientInfo sets the internal getter for retrieving a ClientInfo
func (*FakeCli) SetConfigFile ¶
func (c *FakeCli) SetConfigFile(configfile *configfile.ConfigFile)
SetConfigFile sets the "fake" config file
func (*FakeCli) SetContainerizedEngineClient ¶
func (c *FakeCli) SetContainerizedEngineClient(containerizedEngineClientFunc containerizedEngineFuncType)
SetContainerizedEngineClient on the fake cli
func (*FakeCli) SetManifestStore ¶
func (c *FakeCli) SetManifestStore(store manifeststore.Store)
SetManifestStore on the fake cli
func (*FakeCli) SetNotaryClient ¶
func (c *FakeCli) SetNotaryClient(notaryClientFunc NotaryClientFuncType)
SetNotaryClient sets the internal getter for retrieving a NotaryClient
func (*FakeCli) SetRegistryClient ¶
func (c *FakeCli) SetRegistryClient(client registryclient.RegistryClient)
SetRegistryClient on the fake cli
type FakeStore ¶
type FakeStore struct {
// contains filtered or unexported fields
}
FakeStore implements a credentials.Store that only acts as an in memory map
func (*FakeStore) Get ¶
func (c *FakeStore) Get(serverAddress string) (types.AuthConfig, error)
Get retrieves credentials for a specific server from the map store.
func (*FakeStore) GetAll ¶
func (c *FakeStore) GetAll() (map[string]types.AuthConfig, error)
GetAll returns the key value pairs of ServerAddress => Username
func (*FakeStore) SetEraseFunc ¶
SetEraseFunc is used to overrides Erase function
func (*FakeStore) SetGetAllFunc ¶
func (c *FakeStore) SetGetAllFunc(getAllFunc func() (map[string]types.AuthConfig, error))
SetGetAllFunc is used to overrides GetAll function
func (*FakeStore) SetGetFunc ¶
func (c *FakeStore) SetGetFunc(getFunc func(string) (types.AuthConfig, error))
SetGetFunc is used to overrides Get function
func (*FakeStore) SetStore ¶
func (c *FakeStore) SetStore(store map[string]types.AuthConfig)
SetStore is used to overrides Set function
func (*FakeStore) SetStoreFunc ¶
func (c *FakeStore) SetStoreFunc(storeFunc func(types.AuthConfig) error)
SetStoreFunc is used to override Store function
type NotaryClientFuncType ¶
type NotaryClientFuncType func(imgRefAndAuth trust.ImageRefAndAuth, actions []string) (notaryclient.Repository, error)
NotaryClientFuncType defines a function that returns a fake notary client