// NewEnvironmentsCommandForTest returns a EnvironmentsCommand with the API // and userCreds provided as specified. func NewEnvironmentsCommandForTest(envAPI EnvironmentsEnvAPI, sysAPI EnvironmentsSysAPI, userCreds *configstore.APICredentials) cmd.Command { return envcmd.WrapController(&environmentsCommand{ envAPI: envAPI, sysAPI: sysAPI, userCreds: userCreds, }) }
// NewChangePasswordCommand returns a ChangePasswordCommand with the api // and writer provided as specified. func NewChangePasswordCommandForTest(api ChangePasswordAPI, writer EnvironInfoCredsWriter) (cmd.Command, *ChangePasswordCommand) { c := &changePasswordCommand{ api: api, writer: writer, } return envcmd.WrapController(c), &ChangePasswordCommand{c} }
// NewCreateEnvironmentCommandForTest returns a CreateEnvironmentCommand with // the api provided as specified. func NewCreateEnvironmentCommandForTest(api CreateEnvironmentAPI, parser func(interface{}) (interface{}, error)) (cmd.Command, *CreateEnvironmentCommand) { c := &createEnvironmentCommand{ api: api, configParser: parser, } return envcmd.WrapController(c), &CreateEnvironmentCommand{c} }
// NewListCommand returns a ListCommand with the api provided as specified. func NewListCommandForTest(api UserInfoAPI) cmd.Command { c := &listCommand{ infoCommandBase: infoCommandBase{ api: api, }, } return envcmd.WrapController(c) }
// NewUseEnvironmentCommandForTest returns a UseEnvironmentCommand with the // API and userCreds provided as specified. func NewUseEnvironmentCommandForTest(api UseEnvironmentAPI, userCreds *configstore.APICredentials, endpoint *configstore.APIEndpoint) (cmd.Command, *UseEnvironmentCommand) { c := &useEnvironmentCommand{ api: api, userCreds: userCreds, endpoint: endpoint, } return envcmd.WrapController(c), &UseEnvironmentCommand{c} }
// NewEnableCommand returns a EnableCommand with the api provided as // specified. func NewEnableCommandForTest(api disenableUserAPI) (cmd.Command, *DisenableUserBase) { c := &enableCommand{ disenableUserBase{ api: api, }, } return envcmd.WrapController(c), &DisenableUserBase{&c.disenableUserBase} }
// NewCreateEnvironmentCommand returns a command to create an environment. func NewCreateEnvironmentCommand() cmd.Command { return envcmd.WrapController(&createEnvironmentCommand{}) }
func NewListCommand() cmd.Command { return envcmd.WrapController(&listCommand{}) }
func NewCredentialsCommand() cmd.Command { return envcmd.WrapController(&credentialsCommand{}) }
func NewDisableCommand() cmd.Command { return envcmd.WrapController(&disableCommand{}) }
func NewShowUserCommandForTest(api UserInfoAPI) cmd.Command { return envcmd.WrapController(&infoCommand{ infoCommandBase: infoCommandBase{ api: api, }}) }
func (s *ControllerCommandSuite) TestWrapWithoutFlags(c *gc.C) { cmd := new(testControllerCommand) wrapped := envcmd.WrapController(cmd, envcmd.ControllerSkipFlags) err := cmdtesting.InitCommand(wrapped, []string{"-s", "testsys"}) c.Assert(err, gc.ErrorMatches, "flag provided but not defined: -s") }
// NewRemoveBlocksCommandForTest returns a RemoveBlocksCommand with the // function used to open the API connection mocked out. func NewRemoveBlocksCommandForTest(api removeBlocksAPI) cmd.Command { return envcmd.WrapController(&removeBlocksCommand{ api: api, }) }
// NewListBlocksCommandForTest returns a ListBlocksCommand with the controller // endpoint mocked out. func NewListBlocksCommandForTest(api listBlocksAPI, apierr error) cmd.Command { return envcmd.WrapController(&listBlocksCommand{ api: api, apierr: apierr, }) }
func NewEnableCommand() cmd.Command { return envcmd.WrapController(&enableCommand{}) }
// NewUseEnvironmentCommand returns a command that caches information // about an environment the user can use in the controller locally. func NewUseEnvironmentCommand() cmd.Command { return envcmd.WrapController(&useEnvironmentCommand{}) }
func NewAddCommandForTest(api AddUserAPI) (cmd.Command, *AddCommand) { c := &addCommand{api: api} return envcmd.WrapController(c), &AddCommand{c} }
func initTestControllerCommand(c *gc.C, args ...string) (*testControllerCommand, error) { cmd := new(testControllerCommand) wrapped := envcmd.WrapController(cmd) return cmd, cmdtesting.InitCommand(wrapped, args) }
func NewCredentialsCommandForTest() (cmd.Command, *CredentialsCommand) { c := &credentialsCommand{} return envcmd.WrapController(c), &CredentialsCommand{c} }
// NewEnvironmentsCommand returns a command to list environments. func NewEnvironmentsCommand() cmd.Command { return envcmd.WrapController(&environmentsCommand{}) }
func NewAddCommand() cmd.Command { return envcmd.WrapController(&addCommand{}) }
// NewRemoveBlocksCommand returns a command that allows a controller admin // to remove blocks from the controller. func NewRemoveBlocksCommand() cmd.Command { return envcmd.WrapController(&removeBlocksCommand{}) }
func NewChangePasswordCommand() cmd.Command { return envcmd.WrapController(&changePasswordCommand{}) }
func NewShowUserCommand() cmd.Command { return envcmd.WrapController(&infoCommand{}) }