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


Golang FakeUserRepository.ListUsersByRole方法代碼示例

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


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

示例1:

			org.Guid = "the-org-guid"

			user1 = models.UserFields{}
			user1.Username = "user1"
			user2 = models.UserFields{}
			user2.Username = "user2"

			requirementsFactory.LoginSuccess = true
			requirementsFactory.Organization = org
		})

		Context("shows friendly messaage when no users in ORG_MANAGER role", func() {
			It("shows the special users in the given org", func() {
				userRepo.ListUsersByRole = map[string][]models.UserFields{
					models.ORG_MANAGER:     []models.UserFields{},
					models.BILLING_MANAGER: []models.UserFields{user1},
					models.ORG_AUDITOR:     []models.UserFields{user2},
				}

				runCommand("the-org")

				Expect(userRepo.ListUsersOrganizationGuid).To(Equal("the-org-guid"))
				Expect(ui.Outputs).To(BeInDisplayOrder(
					[]string{"Getting users in org", "the-org", "my-user"},
					[]string{"ORG MANAGER"},
					[]string{"  No ORG MANAGER found"},
					[]string{"BILLING MANAGER"},
					[]string{"  user1"},
					[]string{"ORG AUDITOR"},
					[]string{"  user2"},
				))
開發者ID:rakutentech,項目名稱:cli,代碼行數:31,代碼來源:org_users_test.go

示例2:

			space.Guid = "space1-guid"

			requirementsFactory.Organization = org
			spaceRepo.FindByNameInOrgSpace = space

			user := models.UserFields{}
			user.Username = "user1"
			user2 := models.UserFields{}
			user2.Username = "user2"
			user3 := models.UserFields{}
			user3.Username = "user3"
			user4 := models.UserFields{}
			user4.Username = "user4"
			userRepo.ListUsersByRole = map[string][]models.UserFields{
				models.SPACE_MANAGER:   []models.UserFields{user, user2},
				models.SPACE_DEVELOPER: []models.UserFields{user4},
				models.SPACE_AUDITOR:   []models.UserFields{user3},
			}
		})

		It("tells you about the space users in the given space", func() {
			runCommand("my-org", "my-space")

			Expect(spaceRepo.FindByNameInOrgName).To(Equal("my-space"))
			Expect(spaceRepo.FindByNameInOrgOrgGuid).To(Equal("org1-guid"))
			Expect(userRepo.ListUsersSpaceGuid).To(Equal("space1-guid"))

			Expect(ui.Outputs).To(ContainSubstrings(
				[]string{"Getting users in org", "Org1", "Space1", "my-user"},
				[]string{"SPACE MANAGER"},
				[]string{"user1"},
開發者ID:MontesClarosServidores,項目名稱:cli,代碼行數:31,代碼來源:space_users_test.go


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