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


Golang UserFields.Guid方法代碼示例

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


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

示例1:

			requirementsFactory.LoginSuccess = true
			runCommand("username", "org", "role")
			Expect(testcmd.CommandDidPassRequirements).To(BeTrue())

			Expect(requirementsFactory.UserUsername).To(Equal("username"))
			Expect(requirementsFactory.OrganizationName).To(Equal("org"))
		})
	})

	Context("when logged in", func() {
		BeforeEach(func() {
			requirementsFactory.LoginSuccess = true

			user := models.UserFields{}
			user.Username = "some-user"
			user.Guid = "some-user-guid"
			org := models.Organization{}
			org.Name = "some-org"
			org.Guid = "some-org-guid"

			requirementsFactory.UserFields = user
			requirementsFactory.Organization = org
		})

		It("unsets a user's org role", func() {
			runCommand("my-username", "my-org", "OrgManager")

			Expect(ui.Outputs).To(ContainSubstrings(
				[]string{"Removing role", "OrgManager", "my-username", "my-org", "my-user"},
				[]string{"OK"},
			))
開發者ID:hail100,項目名稱:cli,代碼行數:31,代碼來源:unset_org_role_test.go

示例2:

		BeforeEach(func() {
			configRepo.SetApiVersion("2.22.0")
		})

		Context("single roles", func() {

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

				// org managers
				user := models.UserFields{}
				user.Username = "user1"
				user.Guid = "1111"

				user2 := models.UserFields{}
				user2.Username = "user2"
				user2.Guid = "2222"

				// billing manager
				user3 := models.UserFields{}
				user3.Username = "user3"
				user3.Guid = "3333"

				// auditors
				user4 := models.UserFields{}
				user4.Username = "user4"
				user4.Guid = "4444"
開發者ID:vframbach,項目名稱:cli,代碼行數:29,代碼來源:org_users_test.go

示例3:

	"github.com/cloudfoundry/cli/cf/models"
	. "github.com/cloudfoundry/cli/cf/requirements"
	testapi "github.com/cloudfoundry/cli/testhelpers/api"
	testassert "github.com/cloudfoundry/cli/testhelpers/assert"
	testterm "github.com/cloudfoundry/cli/testhelpers/terminal"
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"

	. "github.com/cloudfoundry/cli/testhelpers/matchers"
)

var _ = Describe("Testing with ginkgo", func() {
	It("TestUserReqExecute", func() {
		user := models.UserFields{}
		user.Username = "my-user"
		user.Guid = "my-user-guid"

		userRepo := &testapi.FakeUserRepository{FindByUsernameUserFields: user}
		ui := new(testterm.FakeUI)

		userReq := NewUserRequirement("foo", ui, userRepo)
		success := userReq.Execute()

		Expect(success).To(BeTrue())
		Expect(userRepo.FindByUsernameUsername).To(Equal("foo"))
		Expect(userReq.GetUser()).To(Equal(user))
	})

	It("TestUserReqWhenUserDoesNotExist", func() {
		userRepo := &testapi.FakeUserRepository{FindByUsernameNotFound: true}
		ui := new(testterm.FakeUI)
開發者ID:palakmathur,項目名稱:cli,代碼行數:31,代碼來源:user_test.go


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