Example #1
0
// 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,
	})
}
Example #2
0
// 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}
}
Example #3
0
// 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}
}
Example #4
0
// 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)
}
Example #5
0
// 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}
}
Example #6
0
// 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}
}
Example #7
0
// NewCreateEnvironmentCommand returns a command to create an environment.
func NewCreateEnvironmentCommand() cmd.Command {
	return envcmd.WrapController(&createEnvironmentCommand{})
}
Example #8
0
File: list.go Project: imoapps/juju
func NewListCommand() cmd.Command {
	return envcmd.WrapController(&listCommand{})
}
Example #9
0
func NewCredentialsCommand() cmd.Command {
	return envcmd.WrapController(&credentialsCommand{})
}
Example #10
0
func NewDisableCommand() cmd.Command {
	return envcmd.WrapController(&disableCommand{})
}
Example #11
0
func NewShowUserCommandForTest(api UserInfoAPI) cmd.Command {
	return envcmd.WrapController(&infoCommand{
		infoCommandBase: infoCommandBase{
			api: api,
		}})
}
Example #12
0
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")
}
Example #13
0
// 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,
	})
}
Example #14
0
// 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,
	})
}
Example #15
0
func NewEnableCommand() cmd.Command {
	return envcmd.WrapController(&enableCommand{})
}
Example #16
0
// 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{})
}
Example #17
0
func NewAddCommandForTest(api AddUserAPI) (cmd.Command, *AddCommand) {
	c := &addCommand{api: api}
	return envcmd.WrapController(c), &AddCommand{c}
}
Example #18
0
func initTestControllerCommand(c *gc.C, args ...string) (*testControllerCommand, error) {
	cmd := new(testControllerCommand)
	wrapped := envcmd.WrapController(cmd)
	return cmd, cmdtesting.InitCommand(wrapped, args)
}
Example #19
0
func NewCredentialsCommandForTest() (cmd.Command, *CredentialsCommand) {
	c := &credentialsCommand{}
	return envcmd.WrapController(c), &CredentialsCommand{c}
}
Example #20
0
// NewEnvironmentsCommand returns a command to list environments.
func NewEnvironmentsCommand() cmd.Command {
	return envcmd.WrapController(&environmentsCommand{})
}
Example #21
0
File: add.go Project: imoapps/juju
func NewAddCommand() cmd.Command {
	return envcmd.WrapController(&addCommand{})
}
Example #22
0
// NewRemoveBlocksCommand returns a command that allows a controller admin
// to remove blocks from the controller.
func NewRemoveBlocksCommand() cmd.Command {
	return envcmd.WrapController(&removeBlocksCommand{})
}
Example #23
0
func NewChangePasswordCommand() cmd.Command {
	return envcmd.WrapController(&changePasswordCommand{})
}
Example #24
0
File: info.go Project: imoapps/juju
func NewShowUserCommand() cmd.Command {
	return envcmd.WrapController(&infoCommand{})
}