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


Golang FakeOrgRepository.Organizations方法代码示例

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


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

示例1:

		servicePlanVisibilityRepo.ListReturns([]models.ServicePlanVisibilityFields{
			{ServicePlanGuid: "service-plan2-guid", OrganizationGuid: "org-guid"},
			{ServicePlanGuid: "service-plan2-guid", OrganizationGuid: "org2-guid"},
		}, nil)

		org1 := models.Organization{}
		org1.Name = "org1"
		org1.Guid = "org-guid"

		org2 := models.Organization{}
		org2.Name = "org2"
		org2.Guid = "org2-guid"

		orgRepo.Organizations = []models.Organization{
			org1,
			org2,
		}
	})

	Describe("GetBrokerWithSingleService", func() {
		It("Returns a single broker contained in a slice with all dependencies populated", func() {
			brokers, err := actor.GetBrokerWithSingleService("my-service2")
			Expect(err).NotTo(HaveOccurred())

			Expect(len(brokers)).To(Equal(1))
			Expect(len(brokers[0].Services)).To(Equal(1))

			Expect(brokers[0].Services[0].Guid).To(Equal("service-guid2"))
			Expect(brokers[0].Services[0].Plans[0].Name).To(Equal("service-plan2"))
			Expect(brokers[0].Services[0].Plans[0].OrgNames).To(Equal([]string{"org1", "org2"}))
		})
开发者ID:EthanWu,项目名称:cli,代码行数:31,代码来源:services_test.go

示例2:

		})

		Context("when everything exists", func() {
			BeforeEach(func() {
				securityGroup := models.SecurityGroup{
					SecurityGroupFields: models.SecurityGroupFields{
						Name:  "my-group",
						Guid:  "my-group-guid",
						Rules: []map[string]interface{}{},
					},
				}

				securityGroupRepo.ReadReturns(securityGroup, nil)

				orgRepo.Organizations = []models.Organization{
					{OrganizationFields: models.OrganizationFields{Name: "my-org", Guid: "my-org-guid"}},
				}

				spaceRepo.FindByNameInOrgSpace = models.Space{SpaceFields: models.SpaceFields{Name: "my-space", Guid: "my-space-guid"}}
			})

			It("removes the security group when we only pass the security group name (using the targeted org and space)", func() {
				runCommand("my-group")

				Expect(ui.Outputs).To(ContainSubstrings(
					[]string{"Removing security group", "my-org", "my-space", "my-user"},
					[]string{"OK"},
				))
				securityGroupGuid, spaceGuid := secBinder.UnbindSpaceArgsForCall(0)
				Expect(securityGroupGuid).To(Equal("my-group-guid"))
				Expect(spaceGuid).To(Equal("my-space-guid"))
开发者ID:janfalee,项目名称:cli,代码行数:31,代码来源:unassign_security_group_test.go

示例3:

		})

		var expectOrgToBeCleared = func() {
			Expect(config.OrganizationFields()).To(Equal(models.OrganizationFields{}))
		}

		var expectSpaceToBeCleared = func() {
			Expect(config.SpaceFields()).To(Equal(models.SpaceFields{}))
		}

		It("it updates the organization in the config", func() {
			org := models.Organization{}
			org.Name = "my-organization"
			org.Guid = "my-organization-guid"

			orgRepo.Organizations = []models.Organization{org}
			orgRepo.FindByNameOrganization = org

			callTarget([]string{"-o", "my-organization"})

			Expect(orgRepo.FindByNameName).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"
开发者ID:janfalee,项目名称:cli,代码行数:30,代码来源:target_test.go

示例4:

				runCommand("sec group", "org", "space")

				Expect(fakeOrgRepo.FindByNameName).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.Organizations = append(fakeOrgRepo.Organizations, org) // TODO: replace this with countfeiter
				fakeSpaceRepo.FindByNameInOrgError = errors.NewModelNotFoundError("Space", "space-name")
			})

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

				Expect(fakeSpaceRepo.FindByNameInOrgName).To(Equal("space-name"))
				Expect(fakeSpaceRepo.FindByNameInOrgOrgGuid).To(Equal("org-guid"))
				Expect(ui.Outputs).To(ContainSubstrings(
					[]string{"FAILED"},
					[]string{"Space", "space-name", "not found"},
				))
			})
		})
开发者ID:hail100,项目名称:cli,代码行数:30,代码来源:bind_security_group_test.go

示例5:

				org1.Guid = "some-org-guid"
				org1.Name = "some-org"

				org2 = models.Organization{}
				org2.Guid = "my-new-org-guid"
				org2.Name = "my-new-org"

				space1 := models.Space{}
				space1.Guid = "my-space-guid"
				space1.Name = "my-space"

				space2 = models.Space{}
				space2.Guid = "some-space-guid"
				space2.Name = "some-space"

				orgRepo.Organizations = []models.Organization{org1, org2}
				spaceRepo.Spaces = []models.Space{space1, space2}
			})

			It("lets the user select an org and space by number", func() {
				OUT_OF_RANGE_CHOICE := "3"

				ui.Inputs = []string{"api.example.com", "[email protected]", "password", OUT_OF_RANGE_CHOICE, "2", OUT_OF_RANGE_CHOICE, "1"}

				l := NewLogin(ui, Config, authRepo, endpointRepo, orgRepo, spaceRepo)
				testcmd.RunCommand(l, Flags, nil)

				Expect(ui.Outputs).To(ContainSubstrings(
					[]string{"Select an org"},
					[]string{"1. some-org"},
					[]string{"2. my-new-org"},
开发者ID:BlueSpice,项目名称:cli,代码行数:31,代码来源:login_test.go


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