本文整理匯總了Golang中cf/models.Space.Guid方法的典型用法代碼示例。如果您正苦於以下問題:Golang Space.Guid方法的具體用法?Golang Space.Guid怎麽用?Golang Space.Guid使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類cf/models.Space
的用法示例。
在下文中一共展示了Space.Guid方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: setUpLoginTestContext
func setUpLoginTestContext() (c *LoginTestContext) {
c = new(LoginTestContext)
c.Config = testconfig.NewRepository()
c.ui = &testterm.FakeUI{}
c.authRepo = &testapi.FakeAuthenticationRepository{
AccessToken: "my_access_token",
RefreshToken: "my_refresh_token",
Config: c.Config,
}
c.endpointRepo = &testapi.FakeEndpointRepo{Config: c.Config}
org := models.Organization{}
org.Name = "my-org"
org.Guid = "my-org-guid"
c.orgRepo = &testapi.FakeOrgRepository{
Organizations: []models.Organization{org},
}
space := models.Space{}
space.Name = "my-space"
space.Guid = "my-space-guid"
c.spaceRepo = &testapi.FakeSpaceRepository{
Spaces: []models.Space{space},
}
return
}
示例2:
Expect(testcmd.CommandDidPassRequirements).To(BeFalse())
})
})
Describe("when the user provides fewer than two args", func() {
It("fails with usage", func() {
callRenameSpace([]string{"foo"})
Expect(ui.FailedWithUsage).To(BeTrue())
})
})
Describe("when the user is logged in and has provided an old and new space name", func() {
BeforeEach(func() {
space := models.Space{}
space.Name = "the-old-space-name"
space.Guid = "the-old-space-guid"
reqFactory.Space = space
})
It("renames a space", func() {
originalSpaceName := configRepo.SpaceFields().Name
callRenameSpace([]string{"the-old-space-name", "my-new-space"})
testassert.SliceContains(ui.Outputs, testassert.Lines{
{"Renaming space", "the-old-space-name", "my-new-space", "my-org", "my-user"},
{"OK"},
})
Expect(spaceRepo.RenameSpaceGuid).To(Equal("the-old-space-guid"))
Expect(spaceRepo.RenameNewName).To(Equal("my-new-space"))
Expect(configRepo.SpaceFields().Name).To(Equal(originalSpaceName))
示例3:
It("TestTargetSpaceWhenNoOrganizationIsSelected", func() {
config.SetOrganizationFields(models.OrganizationFields{})
ui := callTarget([]string{"-s", "my-space"}, reqFactory, config, orgRepo, spaceRepo)
testassert.SliceContains(ui.Outputs, testassert.Lines{
{"FAILED"},
{"An org must be targeted before targeting a space"},
})
Expect(config.OrganizationFields().Guid).To(Equal(""))
})
It("TestTargetSpaceWhenUserHasAccess", func() {
space := models.Space{}
space.Name = "my-space"
space.Guid = "my-space-guid"
spaceRepo.Spaces = []models.Space{space}
spaceRepo.FindByNameSpace = space
ui := callTarget([]string{"-s", "my-space"}, reqFactory, config, orgRepo, spaceRepo)
Expect(spaceRepo.FindByNameName).To(Equal("my-space"))
Expect(config.SpaceFields().Guid).To(Equal("my-space-guid"))
Expect(ui.ShowConfigurationCalled).To(BeTrue())
})
It("TestTargetSpaceWhenUserDoesNotHaveAccess", func() {
config.SetSpaceFields(models.SpaceFields{})
spaceRepo.FindByNameErr = true
示例4:
RefreshToken: "my_refresh_token",
Config: Config,
}
endpointRepo = &testapi.FakeEndpointRepo{}
org := models.Organization{}
org.Name = "my-new-org"
org.Guid = "my-new-org-guid"
orgRepo = &testapi.FakeOrgRepository{
Organizations: []models.Organization{org},
FindByNameOrganization: models.Organization{},
}
space := models.Space{}
space.Guid = "my-space-guid"
space.Name = "my-space"
spaceRepo = &testapi.FakeSpaceRepository{
Spaces: []models.Space{space},
}
authRepo.GetLoginPromptsReturns.Prompts = map[string]configuration.AuthPrompt{
"username": configuration.AuthPrompt{
DisplayName: "Username",
Type: configuration.AuthPromptTypeText,
},
"password": configuration.AuthPrompt{
DisplayName: "Password",
Type: configuration.AuthPromptTypePassword,
},
示例5: defaultDeleteSpaceSpace
func defaultDeleteSpaceSpace() models.Space {
space := models.Space{}
space.Name = "space-to-delete"
space.Guid = "space-to-delete-guid"
return space
}
示例6:
Expect(testcmd.CommandDidPassRequirements).To(BeFalse())
requirementsFactory.LoginSuccess = true
callSpaceUsers(args, requirementsFactory, spaceRepo, userRepo)
Expect(testcmd.CommandDidPassRequirements).To(BeTrue())
Expect("my-org").To(Equal(requirementsFactory.OrganizationName))
})
It("TestSpaceUsers", func() {
org := models.Organization{}
org.Name = "Org1"
org.Guid = "org1-guid"
space := models.Space{}
space.Name = "Space1"
space.Guid = "space1-guid"
requirementsFactory := &testreq.FakeReqFactory{LoginSuccess: true, Organization: org}
spaceRepo := &testapi.FakeSpaceRepository{FindByNameInOrgSpace: space}
userRepo := &testapi.FakeUserRepository{}
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},