本文整理汇总了Golang中github.com/cloudfoundry/cli/cf/requirements/requirementsfakes.FakeSpaceRequirement类的典型用法代码示例。如果您正苦于以下问题:Golang FakeSpaceRequirement类的具体用法?Golang FakeSpaceRequirement怎么用?Golang FakeSpaceRequirement使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FakeSpaceRequirement类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1:
It("fails requirements when not logged in", func() {
requirementsFactory.NewLoginRequirementReturns(requirements.Failing{Message: "not logged in"})
Expect(runCommand("my-space")).To(BeFalse())
})
It("does not pass requirements if org is not targeted", func() {
targetedOrgReq := new(requirementsfakes.FakeTargetedOrgRequirement)
targetedOrgReq.ExecuteReturns(errors.New("no org targeted"))
requirementsFactory.NewTargetedOrgRequirementReturns(targetedOrgReq)
Expect(runCommand("my-space")).To(BeFalse())
})
It("does not pass requirements if space does not exist", func() {
requirementsFactory.NewTargetedOrgRequirementReturns(new(requirementsfakes.FakeTargetedOrgRequirement))
spaceReq := new(requirementsfakes.FakeSpaceRequirement)
spaceReq.ExecuteReturns(errors.New("no space"))
requirementsFactory.NewSpaceRequirementReturns(spaceReq)
Expect(runCommand("my-space")).To(BeFalse())
})
})
Describe("disallow-space-ssh", func() {
var space models.Space
BeforeEach(func() {
requirementsFactory.NewLoginRequirementReturns(requirements.Passing{})
requirementsFactory.NewTargetedOrgRequirementReturns(new(requirementsfakes.FakeTargetedOrgRequirement))
space = models.Space{}
开发者ID:jsloyer,项目名称:cli,代码行数:31,代码来源:disallow_space_ssh_test.go
示例2:
testterm "github.com/cloudfoundry/cli/testhelpers/terminal"
. "github.com/cloudfoundry/cli/testhelpers/matchers"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("CreateRoute", func() {
var (
ui *testterm.FakeUI
routeRepo *apifakes.FakeRouteRepository
configRepo coreconfig.Repository
cmd commandregistry.Command
deps commandregistry.Dependency
factory *requirementsfakes.FakeFactory
flagContext flags.FlagContext
spaceRequirement *requirementsfakes.FakeSpaceRequirement
domainRequirement *requirementsfakes.FakeDomainRequirement
minAPIVersionRequirement requirements.Requirement
)
BeforeEach(func() {
ui = &testterm.FakeUI{}
configRepo = testconfig.NewRepositoryWithDefaults()
routeRepo = new(apifakes.FakeRouteRepository)
repoLocator := deps.RepoLocator.SetRouteRepository(routeRepo)
deps = commandregistry.Dependency{
UI: ui,
开发者ID:Reejoshi,项目名称:cli,代码行数:32,代码来源:create_route_test.go
示例3:
"github.com/cloudfoundry/cli/cf/api"
"github.com/cloudfoundry/cli/cf/commands/space"
"github.com/cloudfoundry/cli/cf/models"
"github.com/cloudfoundry/cli/cf/requirements"
"github.com/cloudfoundry/cli/cf/requirements/requirementsfakes"
"github.com/cloudfoundry/cli/flags"
. "github.com/cloudfoundry/cli/testhelpers/matchers"
)
var _ = Describe("space command", func() {
var (
ui *testterm.FakeUI
loginReq *requirementsfakes.FakeRequirement
targetedOrgReq *requirementsfakes.FakeTargetedOrgRequirement
reqFactory *requirementsfakes.FakeFactory
deps commandregistry.Dependency
cmd space.ShowSpace
flagContext flags.FlagContext
getSpaceModel *plugin_models.GetSpace_Model
spaceRequirement *requirementsfakes.FakeSpaceRequirement
quotaRepo *spacequotasfakes.FakeSpaceQuotaRepository
)
BeforeEach(func() {
ui = new(testterm.FakeUI)
quotaRepo = new(spacequotasfakes.FakeSpaceQuotaRepository)
repoLocator := api.RepositoryLocator{}
repoLocator = repoLocator.SetSpaceQuotaRepository(quotaRepo)
getSpaceModel = new(plugin_models.GetSpace_Model)
deps = commandregistry.Dependency{
UI: ui,
开发者ID:Reejoshi,项目名称:cli,代码行数:32,代码来源:space_test.go
示例4:
callRenameSpace([]string{"foo"})
Expect(ui.Outputs()).To(ContainSubstrings(
[]string{"Incorrect Usage", "Requires", "arguments"},
))
})
})
Describe("when the user is logged in and has provided an old and new space name", func() {
var space models.Space
BeforeEach(func() {
requirementsFactory.NewLoginRequirementReturns(requirements.Passing{})
requirementsFactory.NewTargetedOrgRequirementReturns(new(requirementsfakes.FakeTargetedOrgRequirement))
space = models.Space{}
space.Name = "the-old-space-name"
space.GUID = "the-old-space-guid"
spaceReq := new(requirementsfakes.FakeSpaceRequirement)
spaceReq.GetSpaceReturns(space)
requirementsFactory.NewSpaceRequirementReturns(spaceReq)
})
It("renames a space", func() {
originalSpaceName := configRepo.SpaceFields().Name
callRenameSpace([]string{"the-old-space-name", "my-new-space"})
Expect(ui.Outputs()).To(ContainSubstrings(
[]string{"Renaming space", "the-old-space-name", "my-new-space", "my-org", "my-user"},
[]string{"OK"},
))
spaceGUID, name := spaceRepo.RenameArgsForCall(0)
Expect(spaceGUID).To(Equal("the-old-space-guid"))
开发者ID:Reejoshi,项目名称:cli,代码行数:31,代码来源:rename_space_test.go
注:本文中的github.com/cloudfoundry/cli/cf/requirements/requirementsfakes.FakeSpaceRequirement类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论