本文整理汇总了Golang中github.com/cloudfoundry/cli/cf/api/apifakes.FakeSpaceRepository.FindByNameArgsForCall方法的典型用法代码示例。如果您正苦于以下问题:Golang FakeSpaceRepository.FindByNameArgsForCall方法的具体用法?Golang FakeSpaceRepository.FindByNameArgsForCall怎么用?Golang FakeSpaceRepository.FindByNameArgsForCall使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/cloudfoundry/cli/cf/api/apifakes.FakeSpaceRepository
的用法示例。
在下文中一共展示了FakeSpaceRepository.FindByNameArgsForCall方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1:
Expect(Config.APIEndpoint()).To(Equal("api.example.com"))
Expect(Config.APIVersion()).To(Equal("some-version"))
Expect(Config.AuthenticationEndpoint()).To(Equal("auth/endpoint"))
Expect(Config.SSHOAuthClient()).To(Equal("some-client"))
Expect(Config.MinCLIVersion()).To(Equal("1.0.0"))
Expect(Config.MinRecommendedCLIVersion()).To(Equal("1.0.0"))
Expect(Config.LoggregatorEndpoint()).To(Equal("loggregator/endpoint"))
Expect(Config.DopplerEndpoint()).To(Equal("doppler/endpoint"))
Expect(Config.RoutingAPIEndpoint()).To(Equal("routing/endpoint"))
Expect(endpointRepo.GetCCInfoCallCount()).To(Equal(1))
Expect(endpointRepo.GetCCInfoArgsForCall(0)).To(Equal("api.example.com"))
Expect(orgRepo.FindByNameArgsForCall(0)).To(Equal("my-new-org"))
Expect(spaceRepo.FindByNameArgsForCall(0)).To(Equal("my-space"))
Expect(ui.ShowConfigurationCalled).To(BeTrue())
})
It("lets the user select an org and space by name", func() {
ui.Inputs = []string{"api.example.com", "[email protected]", "password", "my-new-org", "my-space"}
orgRepo.FindByNameReturns(org2, nil)
testcmd.RunCLICommand("login", Flags, nil, updateCommandDependency, false)
Expect(ui.Outputs).To(ContainSubstrings(
[]string{"Select an org"},
[]string{"1. some-org"},
[]string{"2. my-new-org"},
[]string{"Select a space"},
示例2:
spaceRepo = new(apifakes.FakeSpaceRepository)
})
Context("when a space with the given name exists", func() {
It("succeeds", func() {
space := models.Space{}
space.Name = "awesome-sauce-space"
space.GUID = "my-space-guid"
spaceRepo.FindByNameReturns(space, nil)
spaceReq := NewSpaceRequirement("awesome-sauce-space", spaceRepo)
err := spaceReq.Execute()
Expect(err).NotTo(HaveOccurred())
Expect(spaceReq.GetSpace()).To(Equal(space))
Expect(spaceRepo.FindByNameArgsForCall(0)).To(Equal("awesome-sauce-space"))
})
})
Context("when a space with the given name does not exist", func() {
It("errors", func() {
spaceError := errors.New("space-repo-err")
spaceRepo.FindByNameReturns(models.Space{}, spaceError)
err := NewSpaceRequirement("foo", spaceRepo).Execute()
Expect(err).To(HaveOccurred())
Expect(err).To(Equal(spaceError))
})
})
})