本文整理匯總了Golang中code/cloudfoundry/org/cli/cf/api/spaces/spacesfakes.FakeSpaceRepository.FindByNameArgsForCall方法的典型用法代碼示例。如果您正苦於以下問題:Golang FakeSpaceRepository.FindByNameArgsForCall方法的具體用法?Golang FakeSpaceRepository.FindByNameArgsForCall怎麽用?Golang FakeSpaceRepository.FindByNameArgsForCall使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類code/cloudfoundry/org/cli/cf/api/spaces/spacesfakes.FakeSpaceRepository
的用法示例。
在下文中一共展示了FakeSpaceRepository.FindByNameArgsForCall方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1:
Expect(ui.ShowConfigurationCalled).To(BeTrue())
Expect(config.OrganizationFields().GUID).To(Equal("my-organization-guid"))
})
It("updates the space in the config", func() {
space := models.Space{}
space.Name = "my-space"
space.GUID = "my-space-guid"
spaceRepo.FindByNameReturns(space, nil)
callTarget([]string{"-s", "my-space"})
Expect(spaceRepo.FindByNameCallCount()).To(Equal(1))
Expect(spaceRepo.FindByNameArgsForCall(0)).To(Equal("my-space"))
Expect(config.SpaceFields().GUID).To(Equal("my-space-guid"))
Expect(ui.ShowConfigurationCalled).To(BeTrue())
})
It("updates both the organization and the space in the config", func() {
space := models.Space{}
space.Name = "my-space"
space.GUID = "my-space-guid"
spaceRepo.FindByNameReturns(space, nil)
callTarget([]string{"-o", "my-organization", "-s", "my-space"})
Expect(orgRepo.FindByNameCallCount()).To(Equal(1))
Expect(orgRepo.FindByNameArgsForCall(0)).To(Equal("my-organization"))
Expect(config.OrganizationFields().GUID).To(Equal("my-organization-guid"))
示例2:
spaceRepo = new(spacesfakes.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))
})
})
})