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


Golang FakeOrganizationRepository.FindByNameArgsForCall方法代码示例

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


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

示例1:

				Expect(ui.Outputs).To(ContainSubstrings(
					[]string{"FAILED"},
					[]string{"security group", "my-nonexistent-security-group", "not found"},
				))
			})
		})

		Context("when the org does not exist", func() {
			BeforeEach(func() {
				fakeOrgRepo.FindByNameReturns(models.Organization{}, errors.New("Org org not found"))
			})

			It("fails and tells the user", func() {
				runCommand("sec group", "org", "space")

				Expect(fakeOrgRepo.FindByNameArgsForCall(0)).To(Equal("org"))
				Expect(ui.Outputs).To(ContainSubstrings(
					[]string{"FAILED"},
					[]string{"Org", "org", "not found"},
				))
			})
		})

		Context("when the space does not exist", func() {
			BeforeEach(func() {
				org := models.Organization{}
				org.Name = "org-name"
				org.Guid = "org-guid"
				fakeOrgRepo.ListOrgsReturns([]models.Organization{org}, nil)
				fakeOrgRepo.FindByNameReturns(org, nil)
				fakeSpaceRepo.FindByNameInOrgError = errors.NewModelNotFoundError("Space", "space-name")
开发者ID:tools-alexuser01,项目名称:cli,代码行数:31,代码来源:bind_security_group_test.go

示例2:

		}

		Context("there are no errors", func() {
			BeforeEach(func() {
				org := models.Organization{}
				org.Name = "my-organization"
				org.Guid = "my-organization-guid"

				orgRepo.ListOrgsReturns([]models.Organization{org}, nil)
				orgRepo.FindByNameReturns(org, nil)
			})

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

				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.FindByNameArgsForCall(0)).To(Equal("my-space"))
开发者ID:vframbach,项目名称:cli,代码行数:31,代码来源:target_test.go

示例3:

					[]string{"Select an org"},
					[]string{"1. some-org"},
					[]string{"2. my-new-org"},
					[]string{"Select a space"},
					[]string{"1. my-space"},
					[]string{"2. some-space"},
				))

				Expect(Config.OrganizationFields().Guid).To(Equal("my-new-org-guid"))
				Expect(Config.SpaceFields().Guid).To(Equal("my-space-guid"))
				Expect(Config.AccessToken()).To(Equal("my_access_token"))
				Expect(Config.RefreshToken()).To(Equal("my_refresh_token"))

				Expect(endpointRepo.UpdateEndpointReceived).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"},
开发者ID:vframbach,项目名称:cli,代码行数:31,代码来源:login_test.go


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