예제 #1
0
파일: export_test.go 프로젝트: kat-co/juju
// NewDefaultsCommandForTest returns a defaultsCommand with the api provided as specified.
func NewDefaultsCommandForTest(api defaultsCommandAPI, store jujuclient.ClientStore) cmd.Command {
	cmd := &defaultsCommand{
		api: api,
	}
	cmd.SetClientStore(store)
	return modelcmd.WrapController(cmd)
}
예제 #2
0
func NewAddCommandForTest(api StorageAddAPI, store jujuclient.ClientStore) cmd.Command {
	cmd := &addCommand{newAPIFunc: func() (StorageAddAPI, error) {
		return api, nil
	}}
	cmd.SetClientStore(store)
	return modelcmd.Wrap(cmd)
}
예제 #3
0
파일: export_test.go 프로젝트: kat-co/juju
func NewShowUserCommandForTest(api UserInfoAPI, store jujuclient.ClientStore) cmd.Command {
	cmd := &infoCommand{infoCommandBase: infoCommandBase{
		clock: clock.WallClock,
		api:   api}}
	cmd.SetClientStore(store)
	return modelcmd.WrapController(cmd)
}
예제 #4
0
파일: export_test.go 프로젝트: kat-co/juju
// NewGrantCommandForTest returns a GrantCommand with the api provided as specified.
func NewGrantCommandForTest(api GrantModelAPI, store jujuclient.ClientStore) (cmd.Command, *GrantCommand) {
	cmd := &grantCommand{
		api: api,
	}
	cmd.SetClientStore(store)
	return modelcmd.WrapController(cmd), &GrantCommand{cmd}
}
예제 #5
0
func NewPoolCreateCommandForTest(api PoolCreateAPI, store jujuclient.ClientStore) cmd.Command {
	cmd := &poolCreateCommand{newAPIFunc: func() (PoolCreateAPI, error) {
		return api, nil
	}}
	cmd.SetClientStore(store)
	return modelcmd.Wrap(cmd)
}
예제 #6
0
파일: export_test.go 프로젝트: kat-co/juju
// NewRevokeCommandForTest returns an revokeCommand with the api provided as specified.
func NewRevokeCommandForTest(api RevokeModelAPI, store jujuclient.ClientStore) (cmd.Command, *RevokeCommand) {
	cmd := &revokeCommand{
		api: api,
	}
	cmd.SetClientStore(store)
	return modelcmd.WrapController(cmd), &RevokeCommand{cmd}
}
예제 #7
0
func (s *MigrateSuite) runCommand(c *gc.C, args ...string) (*cmd.Context, error) {
	cmd := &migrateCommand{
		api: s.api,
	}
	cmd.SetClientStore(s.store)
	return testing.RunCommand(c, modelcmd.WrapController(cmd), args...)
}
예제 #8
0
파일: export_test.go 프로젝트: bac/juju
// NewDefaultsCommandForTest returns a defaultsCommand with the api provided as specified.
func NewDefaultsCommandForTest(apiRoot api.Connection, dAPI defaultsCommandAPI, cAPI cloudAPI, store jujuclient.ClientStore) cmd.Command {
	cmd := &defaultsCommand{
		newAPIRoot:     func() (api.Connection, error) { return apiRoot, nil },
		newDefaultsAPI: func(caller base.APICallCloser) defaultsCommandAPI { return dAPI },
		newCloudAPI:    func(caller base.APICallCloser) cloudAPI { return cAPI },
	}
	cmd.SetClientStore(store)
	return modelcmd.WrapController(cmd)
}
func (s *ValidateToolsMetadataSuite) TestInitErrors(c *gc.C) {
	for i, t := range validateInitToolsErrorTests {
		c.Logf("test %d", i)
		cmd := &validateToolsMetadataCommand{}
		cmd.SetClientStore(s.store)
		err := coretesting.InitCommand(modelcmd.Wrap(cmd), t.args)
		c.Check(err, gc.ErrorMatches, t.err)
	}
}
예제 #10
0
파일: migrate_test.go 프로젝트: kat-co/juju
func (s *MigrateSuite) makeCommand() *migrateCommand {
	cmd := &migrateCommand{
		api: s.api,
		newAPIRoot: func(jujuclient.ClientStore, string, string) (api.Connection, error) {
			return s.targetControllerAPI, nil
		},
	}
	cmd.SetClientStore(s.store)
	return cmd
}
예제 #11
0
// NewDestroyCommandForTest returns a DestroyCommand with the api provided as specified.
func NewDestroyCommandForTest(api DestroyEnvironmentAPI, store jujuclient.ClientStore) cmd.Command {
	cmd := &destroyCommand{
		api: api,
	}
	cmd.SetClientStore(store)
	return modelcmd.Wrap(
		cmd,
		modelcmd.ModelSkipDefault,
		modelcmd.ModelSkipFlags,
	)
}
예제 #12
0
파일: export_test.go 프로젝트: kat-co/juju
// NewDestroyCommandForTest returns a DestroyCommand with the api provided as specified.
func NewDestroyCommandForTest(api DestroyModelAPI, store jujuclient.ClientStore) cmd.Command {
	cmd := &destroyCommand{
		api: api,
	}
	cmd.SetClientStore(store)
	return modelcmd.Wrap(
		cmd,
		modelcmd.WrapSkipDefaultModel,
		modelcmd.WrapSkipModelFlags,
	)
}
예제 #13
0
// In the case where we cannot examine the client store, we want the
// error to propagate back up to the user.
func (s *BootstrapSuite) TestBootstrapPropagatesStoreErrors(c *gc.C) {
	const controllerName = "devcontroller"
	bootstrappedControllerName(controllerName)
	s.patchVersionAndSeries(c, "raring")

	store := jujuclienttesting.NewStubStore()
	store.SetErrors(errors.New("oh noes"))
	cmd := &bootstrapCommand{}
	cmd.SetClientStore(store)
	_, err := coretesting.RunCommand(c, modelcmd.Wrap(cmd), controllerName, "dummy", "--auto-upgrade")
	c.Assert(err, gc.ErrorMatches, `loading credentials: oh noes`)
}
예제 #14
0
파일: export_test.go 프로젝트: bac/juju
// NewDestroyCommandForTest returns a DestroyCommand with the api provided as specified.
func NewDestroyCommandForTest(
	api DestroyModelAPI,
	refreshFunc func(jujuclient.ClientStore, string) error, store jujuclient.ClientStore,
	sleepFunc func(time.Duration),
) cmd.Command {
	cmd := &destroyCommand{
		api:           api,
		RefreshModels: refreshFunc,
		sleepFunc:     sleepFunc,
	}
	cmd.SetClientStore(store)
	return modelcmd.Wrap(
		cmd,
		modelcmd.WrapSkipDefaultModel,
		modelcmd.WrapSkipModelFlags,
	)
}
예제 #15
0
파일: export_test.go 프로젝트: bac/juju
// NewDestroyCommandForTest returns a DestroyCommand with the controller and
// client endpoints mocked out.
func NewDestroyCommandForTest(
	api destroyControllerAPI,
	clientapi destroyClientAPI,
	store jujuclient.ClientStore,
	apierr error,
) cmd.Command {
	cmd := &destroyCommand{
		destroyCommandBase: destroyCommandBase{
			api:       api,
			clientapi: clientapi,
			apierr:    apierr,
		},
	}
	cmd.SetClientStore(store)
	return modelcmd.WrapController(
		cmd,
		modelcmd.WrapControllerSkipControllerFlags,
		modelcmd.WrapControllerSkipDefaultController,
	)
}
예제 #16
0
파일: export_test.go 프로젝트: bac/juju
func NewUpgradeCharmCommandForTest(
	store jujuclient.ClientStore,
	apiOpener modelcmd.APIOpener,
	deployResources resourceadapters.DeployResourcesFunc,
	resolveCharm ResolveCharmFunc,
	newCharmAdder NewCharmAdderFunc,
	newCharmClient func(api.Connection) CharmClient,
	newCharmUpgradeClient func(api.Connection) CharmUpgradeClient,
	newModelConfigGetter func(api.Connection) ModelConfigGetter,
	newResourceLister func(api.Connection) (ResourceLister, error),
) cmd.Command {
	cmd := &upgradeCharmCommand{
		DeployResources:       deployResources,
		ResolveCharm:          resolveCharm,
		NewCharmAdder:         newCharmAdder,
		NewCharmClient:        newCharmClient,
		NewCharmUpgradeClient: newCharmUpgradeClient,
		NewModelConfigGetter:  newModelConfigGetter,
		NewResourceLister:     newResourceLister,
	}
	cmd.SetClientStore(store)
	cmd.SetAPIOpener(apiOpener)
	return modelcmd.Wrap(cmd)
}
예제 #17
0
func runValidateImageMetadata(c *gc.C, store jujuclient.ClientStore, args ...string) (*cmd.Context, error) {
	cmd := &validateImageMetadataCommand{}
	cmd.SetClientStore(store)
	return coretesting.RunCommand(c, modelcmd.Wrap(cmd), args...)
}
예제 #18
0
파일: export_test.go 프로젝트: bac/juju
// NewShowCommandForTest returns a ShowCommand with the api provided as specified.
func NewShowCommandForTest(api ShowModelAPI, refreshFunc func(jujuclient.ClientStore, string) error, store jujuclient.ClientStore) cmd.Command {
	cmd := &showModelCommand{api: api, RefreshModels: refreshFunc}
	cmd.SetClientStore(store)
	return modelcmd.Wrap(cmd)
}
예제 #19
0
// NewUsersCommandForTest returns a UsersCommand with the api provided as specified.
func NewUsersCommandForTest(api UsersAPI, store jujuclient.ClientStore) cmd.Command {
	cmd := &usersCommand{api: api}
	cmd.SetClientStore(store)
	return modelcmd.Wrap(cmd)
}
예제 #20
0
파일: export_test.go 프로젝트: kat-co/juju
// NewDumpDBCommandForTest returns a DumpDBCommand with the api provided as specified.
func NewDumpDBCommandForTest(api DumpDBAPI, store jujuclient.ClientStore) cmd.Command {
	cmd := &dumpDBCommand{api: api}
	cmd.SetClientStore(store)
	return modelcmd.WrapController(cmd)
}
예제 #21
0
파일: export_test.go 프로젝트: kat-co/juju
// NewShowCommandForTest returns a ShowCommand with the api provided as specified.
func NewShowCommandForTest(api ShowModelAPI, store jujuclient.ClientStore) cmd.Command {
	cmd := &showModelCommand{api: api}
	cmd.SetClientStore(store)
	return modelcmd.Wrap(cmd)
}
예제 #22
0
파일: synctools_test.go 프로젝트: bac/juju
func (s *syncToolsSuite) runSyncToolsCommand(c *gc.C, args ...string) (*cmd.Context, error) {
	cmd := &syncToolsCommand{}
	cmd.SetClientStore(s.store)
	return coretesting.RunCommand(c, modelcmd.Wrap(cmd), args...)
}