本文整理匯總了Golang中github.com/cloudfoundry/cli/cf/requirements/requirementsfakes.FakeRequirement.ExecuteReturns方法的典型用法代碼示例。如果您正苦於以下問題:Golang FakeRequirement.ExecuteReturns方法的具體用法?Golang FakeRequirement.ExecuteReturns怎麽用?Golang FakeRequirement.ExecuteReturns使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/cloudfoundry/cli/cf/requirements/requirementsfakes.FakeRequirement
的用法示例。
在下文中一共展示了FakeRequirement.ExecuteReturns方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1:
repoLocator = repoLocator.SetSpaceQuotaRepository(quotaRepo)
getSpaceModel = new(plugin_models.GetSpace_Model)
deps = commandregistry.Dependency{
UI: ui,
Config: testconfig.NewRepositoryWithDefaults(),
RepoLocator: repoLocator,
PluginModels: &commandregistry.PluginModels{
Space: getSpaceModel,
},
}
reqFactory = new(requirementsfakes.FakeFactory)
loginReq = new(requirementsfakes.FakeRequirement)
loginReq.ExecuteReturns(nil)
reqFactory.NewLoginRequirementReturns(loginReq)
targetedOrgReq = new(requirementsfakes.FakeTargetedOrgRequirement)
targetedOrgReq.ExecuteReturns(nil)
reqFactory.NewTargetedOrgRequirementReturns(targetedOrgReq)
spaceRequirement = new(requirementsfakes.FakeSpaceRequirement)
spaceRequirement.ExecuteReturns(nil)
reqFactory.NewSpaceRequirementReturns(spaceRequirement)
cmd = space.ShowSpace{}
flagContext = flags.NewFlagContext(cmd.MetaData().Flags)
cmd.SetDependency(deps, false)
})
示例2:
requirementsFactory = new(requirementsfakes.FakeFactory)
config = new(coreconfigfakes.FakeRepository)
repoLocator := api.RepositoryLocator{}
repoLocator = repoLocator.SetSpaceQuotaRepository(quotaRepo)
deps = commandregistry.Dependency{
UI: ui,
Config: config,
RepoLocator: repoLocator,
}
reqFactory = new(requirementsfakes.FakeFactory)
loginReq = new(requirementsfakes.FakeRequirement)
loginReq.ExecuteReturns(nil)
reqFactory.NewLoginRequirementReturns(loginReq)
targetedOrgReq = new(requirementsfakes.FakeTargetedOrgRequirement)
targetedOrgReq.ExecuteReturns(nil)
reqFactory.NewTargetedOrgRequirementReturns(targetedOrgReq)
minApiVersionReq = new(requirementsfakes.FakeRequirement)
minApiVersionReq.ExecuteReturns(nil)
reqFactory.NewMinAPIVersionRequirementReturns(minApiVersionReq)
cmd = spacequota.CreateSpaceQuota{}
flagContext = flags.NewFlagContext(cmd.MetaData().Flags)
})
Describe("Requirements", func() {
示例3:
package requirements_test
import (
. "github.com/cloudfoundry/cli/cf/requirements"
"errors"
"github.com/cloudfoundry/cli/cf/requirements/requirementsfakes"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("Requirements", func() {
Context("When there are multiple requirements", func() {
It("executes all the requirements", func() {
r1 := new(requirementsfakes.FakeRequirement)
r1.ExecuteReturns(nil)
r2 := new(requirementsfakes.FakeRequirement)
r2.ExecuteReturns(nil)
// SETUP
requirements := Requirements{
r1,
r2,
}
// EXECUTE
err := requirements.Execute()
// ASSERT
Expect(err).NotTo(HaveOccurred())
Expect(r1.ExecuteCallCount()).To(Equal(1))