當前位置: 首頁>>代碼示例>>Golang>>正文


Golang FakeOrganizationRepository.ListOrgsReturns方法代碼示例

本文整理匯總了Golang中github.com/cloudfoundry/cli/cf/api/organizations/fakes.FakeOrganizationRepository.ListOrgsReturns方法的典型用法代碼示例。如果您正苦於以下問題:Golang FakeOrganizationRepository.ListOrgsReturns方法的具體用法?Golang FakeOrganizationRepository.ListOrgsReturns怎麽用?Golang FakeOrganizationRepository.ListOrgsReturns使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在github.com/cloudfoundry/cli/cf/api/organizations/fakes.FakeOrganizationRepository的用法示例。


在下文中一共展示了FakeOrganizationRepository.ListOrgsReturns方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1:

		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.ListOrgsReturns([]models.Organization{{
					OrganizationFields: models.OrganizationFields{
						Name: "my-org",
						Guid: "my-org-guid",
					}},
				}, nil)

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

			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{"Unbinding security group", "my-org", "my-space", "my-user"},
					[]string{"OK"},
				))
				securityGroupGuid, spaceGuid := secBinder.UnbindSpaceArgsForCall(0)
開發者ID:vframbach,項目名稱:cli,代碼行數:31,代碼來源:unbind_security_group_test.go

示例2:

		var (
			pluginOrgsModel []plugin_models.GetOrgs_Model
		)

		BeforeEach(func() {
			org1 := models.Organization{}
			org1.Name = "Organization-1"
			org1.Guid = "org-1-guid"

			org2 := models.Organization{}
			org2.Name = "Organization-2"

			org3 := models.Organization{}
			org3.Name = "Organization-3"

			orgRepo.ListOrgsReturns([]models.Organization{org1, org2, org3}, nil)

			pluginOrgsModel = []plugin_models.GetOrgs_Model{}
			deps.PluginModels.Organizations = &pluginOrgsModel
		})

		It("populates the plugin models upon execution", func() {
			testcmd.RunCliCommand("orgs", []string{}, requirementsFactory, updateCommandDependency, true)
			Ω(pluginOrgsModel[0].Name).To(Equal("Organization-1"))
			Ω(pluginOrgsModel[0].Guid).To(Equal("org-1-guid"))
			Ω(pluginOrgsModel[1].Name).To(Equal("Organization-2"))
			Ω(pluginOrgsModel[2].Name).To(Equal("Organization-3"))
		})
	})

	Context("when there are orgs to be listed", func() {
開發者ID:vframbach,項目名稱:cli,代碼行數:31,代碼來源:orgs_test.go

示例3:

		org                 models.Organization
	)

	BeforeEach(func() {
		ui = &testterm.FakeUI{
			Inputs: []string{"y"},
		}
		config = testconfig.NewRepositoryWithDefaults()
		requirementsFactory = &testreq.FakeReqFactory{}

		org = models.Organization{}
		org.Name = "org-to-delete"
		org.Guid = "org-to-delete-guid"
		orgRepo = &test_org.FakeOrganizationRepository{}

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

	runCommand := func(args ...string) bool {
		cmd := NewDeleteOrg(ui, config, orgRepo)
		return testcmd.RunCommand(cmd, args, requirementsFactory)
	}

	It("fails requirements when not logged in", func() {
		Expect(runCommand("some-org-name")).To(BeFalse())
	})

	It("fails with usage if no arguments are given", func() {
		runCommand()
		Expect(ui.FailedWithUsage).To(BeTrue())
開發者ID:tools-alexuser01,項目名稱:cli,代碼行數:31,代碼來源:delete_org_test.go


注:本文中的github.com/cloudfoundry/cli/cf/api/organizations/fakes.FakeOrganizationRepository.ListOrgsReturns方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。