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


Golang FakeSpaceRepository.FindByNameReturns方法代码示例

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


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

示例1:

							runCommand("source-app", "target-app")

							Expect(ui.Outputs()).To(ContainSubstrings(
								[]string{"FAILED"},
								[]string{"could not find target app"},
							))
						})
					})
				})

				Describe("when a space is provided, but not an org", func() {
					It("send the correct target appplication for the current org and target space", func() {
						space := models.Space{}
						space.Name = "space-name"
						space.GUID = "model-space-guid"
						spaceRepo.FindByNameReturns(space, nil)

						runCommand("-s", "space-name", "source-app", "target-app")

						targetAppName, spaceGUID := appRepo.ReadFromSpaceArgsForCall(0)
						Expect(targetAppName).To(Equal("target-app"))
						Expect(spaceGUID).To(Equal("model-space-guid"))

						Expect(ui.Outputs()).To(ContainSubstrings(
							[]string{"Copying source from app", "source-app", "to target app", "target-app", "in org my-org / space space-name as my-user..."},
							[]string{"Note: this may take some time"},
							[]string{"OK"},
						))
					})

					Context("Failures", func() {
开发者ID:fujitsu-cf,项目名称:cli,代码行数:31,代码来源:copy_source_test.go

示例2:

			It("it updates the organization in the config", func() {
				callTarget([]string{"-o", "my-organization"})

				Expect(orgRepo.FindByNameCallCount()).To(Equal(1))
				Expect(orgRepo.FindByNameArgsForCall(0)).To(Equal("my-organization"))
				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)
开发者ID:fujitsu-cf,项目名称:cli,代码行数:30,代码来源:target_test.go

示例3:

			requirementsFactory.NewLoginRequirementReturns(requirements.Passing{})
			requirementsFactory.NewTargetedOrgRequirementReturns(new(requirementsfakes.FakeTargetedOrgRequirement))
		})

		It("unassigns a quota from a space", func() {
			space := models.Space{
				SpaceFields: models.SpaceFields{
					Name: "my-space",
					GUID: "my-space-guid",
				},
			}

			quota := models.SpaceQuota{Name: "my-quota", GUID: "my-quota-guid"}

			quotaRepo.FindByNameReturns(quota, nil)
			spaceRepo.FindByNameReturns(space, nil)

			runCommand("my-space", "my-quota")

			Expect(ui.Outputs()).To(ContainSubstrings(
				[]string{"Unassigning space quota", "my-quota", "my-space", "my-user"},
				[]string{"OK"},
			))

			Expect(quotaRepo.FindByNameArgsForCall(0)).To(Equal("my-quota"))
			spaceGUID, quotaGUID := quotaRepo.UnassignQuotaFromSpaceArgsForCall(0)
			Expect(spaceGUID).To(Equal("my-space-guid"))
			Expect(quotaGUID).To(Equal("my-quota-guid"))
		})
	})
})
开发者ID:fujitsu-cf,项目名称:cli,代码行数:31,代码来源:unset_space_quota_test.go

示例4:

				quotaRepo.FindByNameReturns(
					models.SpaceQuota{
						Name:                    "quota-name",
						GUID:                    "quota-guid",
						MemoryLimit:             1024,
						InstanceMemoryLimit:     512,
						RoutesLimit:             111,
						ServicesLimit:           222,
						NonBasicServicesAllowed: true,
						OrgGUID:                 "my-org-guid",
					}, nil)

				spaceRepo.FindByNameReturns(
					models.Space{
						SpaceFields: models.SpaceFields{
							Name: "my-space",
							GUID: "my-space-guid",
						},
						SpaceQuotaGUID: "",
					}, nil)
			})

			Context("when the space quota was not previously assigned to a space", func() {
				It("associates the provided space with the provided space quota", func() {
					Expect(executeErr).NotTo(HaveOccurred())
					spaceGUID, quotaGUID := quotaRepo.AssociateSpaceWithQuotaArgsForCall(0)

					Expect(spaceGUID).To(Equal("my-space-guid"))
					Expect(quotaGUID).To(Equal("quota-guid"))
					Expect(ui.Outputs()).To(ContainSubstrings(
						[]string{"Assigning space quota", "to space", "my-user"},
						[]string{"OK"},
开发者ID:fujitsu-cf,项目名称:cli,代码行数:32,代码来源:set_space_quota_test.go

示例5:

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

var _ = Describe("SpaceRequirement", func() {
	var spaceRepo *spacesfakes.FakeSpaceRepository
	BeforeEach(func() {
		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)
开发者ID:fujitsu-cf,项目名称:cli,代码行数:30,代码来源:space_test.go

示例6:

			It("does not update the api endpoint or ssl setting in the config", func() {
				Expect(Config.APIEndpoint()).To(Equal("api.the-old-endpoint.com"))
				Expect(Config.IsSSLDisabled()).To(BeTrue())
			})

			It("clears Org, and Space in the config", func() {
				Expect(Config.OrganizationFields().GUID).To(BeEmpty())
				Expect(Config.SpaceFields().GUID).To(BeEmpty())
			})
		})

		Describe("and the login fails to target a space", func() {
			BeforeEach(func() {
				Flags = []string{"-u", "[email protected]", "-p", "password", "-o", "my-new-org", "-s", "nonexistent"}
				orgRepo.FindByNameReturns(org, nil)
				spaceRepo.FindByNameReturns(models.Space{}, errors.New("find-by-name-err"))

				Config.SetSSLDisabled(true)
			})

			ItFails()
			ItShowsTheTarget()

			It("does not update the api endpoint or ssl setting in the config", func() {
				Expect(Config.APIEndpoint()).To(Equal("api.the-old-endpoint.com"))
				Expect(Config.IsSSLDisabled()).To(BeTrue())
			})

			It("updates the org in the config", func() {
				Expect(Config.OrganizationFields().GUID).To(Equal("my-new-org-guid"))
			})
开发者ID:fujitsu-cf,项目名称:cli,代码行数:31,代码来源:login_test.go


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