当前位置: 首页>>代码示例>>Golang>>正文


Golang Dependency.Config方法代码示例

本文整理汇总了Golang中github.com/cloudfoundry/cli/cf/command_registry.Dependency.Config方法的典型用法代码示例。如果您正苦于以下问题:Golang Dependency.Config方法的具体用法?Golang Dependency.Config怎么用?Golang Dependency.Config使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在github.com/cloudfoundry/cli/cf/command_registry.Dependency的用法示例。


在下文中一共展示了Dependency.Config方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1:

var _ = Describe("app Command", func() {
	var (
		ui                  *testterm.FakeUI
		configRepo          core_config.Repository
		appSummaryRepo      *testapi.FakeAppSummaryRepo
		appInstancesRepo    *testAppInstanaces.FakeAppInstancesRepository
		appLogsNoaaRepo     *testapi.FakeLogsNoaaRepository
		requirementsFactory *testreq.FakeReqFactory
		app                 models.Application
		deps                command_registry.Dependency
	)

	updateCommandDependency := func(pluginCall bool) {
		deps.Ui = ui
		deps.RepoLocator = deps.RepoLocator.SetLogsNoaaRepository(appLogsNoaaRepo)
		deps.Config = configRepo
		deps.RepoLocator = deps.RepoLocator.SetAppSummaryRepository(appSummaryRepo)
		deps.RepoLocator = deps.RepoLocator.SetAppInstancesRepository(appInstancesRepo)
		command_registry.Commands.SetCommand(command_registry.Commands.FindCommand("app").SetDependency(deps, pluginCall))
	}

	BeforeEach(func() {
		ui = &testterm.FakeUI{}
		appSummaryRepo = &testapi.FakeAppSummaryRepo{}
		appLogsNoaaRepo = &testapi.FakeLogsNoaaRepository{}
		appInstancesRepo = &testAppInstanaces.FakeAppInstancesRepository{}
		configRepo = testconfig.NewRepositoryWithDefaults()
		requirementsFactory = &testreq.FakeReqFactory{
			LoginSuccess:         true,
			TargetedSpaceSuccess: true,
		}
开发者ID:MontesClarosServidores,项目名称:cli,代码行数:31,代码来源:app_test.go

示例2:

	var (
		Flags        []string
		Config       core_config.Repository
		ui           *testterm.FakeUI
		authRepo     *testapi.FakeAuthenticationRepository
		endpointRepo *testapi.FakeEndpointRepo
		orgRepo      *fake_organizations.FakeOrganizationRepository
		spaceRepo    *testapi.FakeSpaceRepository

		org  models.Organization
		deps command_registry.Dependency
	)

	updateCommandDependency := func(pluginCall bool) {
		deps.Ui = ui
		deps.Config = Config
		deps.RepoLocator = deps.RepoLocator.SetEndpointRepository(endpointRepo)
		deps.RepoLocator = deps.RepoLocator.SetAuthenticationRepository(authRepo)
		deps.RepoLocator = deps.RepoLocator.SetOrganizationRepository(orgRepo)
		deps.RepoLocator = deps.RepoLocator.SetSpaceRepository(spaceRepo)
		command_registry.Commands.SetCommand(command_registry.Commands.FindCommand("login").SetDependency(deps, pluginCall))
	}

	listSpacesStub := func(spaces []models.Space) func(func(models.Space) bool) error {
		return func(cb func(models.Space) bool) error {
			var keepGoing bool
			for _, s := range spaces {
				keepGoing = cb(s)
				if !keepGoing {
					return nil
				}
开发者ID:vframbach,项目名称:cli,代码行数:31,代码来源:login_test.go

示例3:

	"github.com/cloudfoundry/cli/cf/configuration/core_config"
	. "github.com/cloudfoundry/cli/testhelpers/matchers"
)

var _ = Describe("stack command", func() {
	var (
		ui                  *testterm.FakeUI
		config              core_config.Repository
		repo                *testapi.FakeStackRepository
		requirementsFactory *testreq.FakeReqFactory
		deps                command_registry.Dependency
	)

	updateCommandDependency := func(pluginCall bool) {
		deps.Ui = ui
		deps.Config = config
		deps.RepoLocator = deps.RepoLocator.SetStackRepository(repo)
		command_registry.Commands.SetCommand(command_registry.Commands.FindCommand("stack").SetDependency(deps, pluginCall))
	}

	BeforeEach(func() {
		ui = &testterm.FakeUI{}
		config = testconfig.NewRepositoryWithDefaults()
		requirementsFactory = &testreq.FakeReqFactory{LoginSuccess: true}
		repo = &testapi.FakeStackRepository{}
	})

	Describe("login requirements", func() {
		It("fails if the user is not logged in", func() {
			requirementsFactory.LoginSuccess = false
开发者ID:vframbach,项目名称:cli,代码行数:30,代码来源:stack_test.go

示例4:

	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"

	. "github.com/cloudfoundry/cli/testhelpers/matchers"
)

var _ = Describe("password command", func() {
	var (
		pwDeps passwordDeps
		ui     *testterm.FakeUI
		deps   command_registry.Dependency
	)

	updateCommandDependency := func(pluginCall bool) {
		deps.Ui = ui
		deps.Config = pwDeps.Config
		deps.RepoLocator = deps.RepoLocator.SetPasswordRepository(pwDeps.PwdRepo)
		command_registry.Commands.SetCommand(command_registry.Commands.FindCommand("passwd").SetDependency(deps, pluginCall))
	}

	callPassword := func(inputs []string, pwDeps passwordDeps) (*testterm.FakeUI, bool) {
		ui = &testterm.FakeUI{Inputs: inputs}
		passed := testcmd.RunCliCommand("passwd", []string{}, pwDeps.ReqFactory, updateCommandDependency, false)
		return ui, passed
	}

	BeforeEach(func() {
		pwDeps = getPasswordDeps()
	})

	It("does not pass requirements if you are not logged in", func() {
开发者ID:vframbach,项目名称:cli,代码行数:31,代码来源:passwd_test.go


注:本文中的github.com/cloudfoundry/cli/cf/command_registry.Dependency.Config方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。