本文整理匯總了Golang中cf.SpaceFields.Name方法的典型用法代碼示例。如果您正苦於以下問題:Golang SpaceFields.Name方法的具體用法?Golang SpaceFields.Name怎麽用?Golang SpaceFields.Name使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類cf.SpaceFields
的用法示例。
在下文中一共展示了SpaceFields.Name方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: TestRunWhenOrganizationExists
func TestRunWhenOrganizationExists(t *testing.T) {
developmentSpaceFields := cf.SpaceFields{}
developmentSpaceFields.Name = "development"
stagingSpaceFields := cf.SpaceFields{}
stagingSpaceFields.Name = "staging"
domainFields := cf.DomainFields{}
domainFields.Name = "cfapps.io"
cfAppDomainFields := cf.DomainFields{}
cfAppDomainFields.Name = "cf-app.com"
org := cf.Organization{}
org.Name = "my-org"
org.Guid = "my-org-guid"
org.QuotaDefinition = cf.NewQuotaFields("cantina-quota", 512)
org.Spaces = []cf.SpaceFields{developmentSpaceFields, stagingSpaceFields}
org.Domains = []cf.DomainFields{domainFields, cfAppDomainFields}
reqFactory := &testreq.FakeReqFactory{Organization: org, LoginSuccess: true}
args := []string{"my-org"}
ui := callShowOrg(t, args, reqFactory)
assert.Equal(t, reqFactory.OrganizationName, "my-org")
testassert.SliceContains(t, ui.Outputs, testassert.Lines{
{"Getting info for org", "my-org", "my-user"},
{"OK"},
{"my-org"},
{" domains:", "cfapps.io", "cf-app.com"},
{" quota: ", "cantina-quota", "512M"},
{" spaces:", "development", "staging"},
})
}
示例2: deleteServiceBroker
func deleteServiceBroker(t *testing.T, confirmation string, args []string) (ui *testterm.FakeUI, reqFactory *testreq.FakeReqFactory, repo *testapi.FakeServiceBrokerRepo) {
serviceBroker := cf.ServiceBroker{}
serviceBroker.Name = "service-broker-to-delete"
serviceBroker.Guid = "service-broker-to-delete-guid"
reqFactory = &testreq.FakeReqFactory{LoginSuccess: true}
repo = &testapi.FakeServiceBrokerRepo{FindByNameServiceBroker: serviceBroker}
ui = &testterm.FakeUI{
Inputs: []string{confirmation},
}
token, err := testconfig.CreateAccessTokenWithTokenInfo(configuration.TokenInfo{
Username: "my-user",
})
assert.NoError(t, err)
space2 := cf.SpaceFields{}
space2.Name = "my-space"
org2 := cf.OrganizationFields{}
org2.Name = "my-org"
config := &configuration.Configuration{
SpaceFields: space2,
OrganizationFields: org2,
AccessToken: token,
}
ctxt := testcmd.NewContext("delete-service-broker", args)
cmd := NewDeleteServiceBroker(ui, config, repo)
testcmd.RunCommand(cmd, ctxt, reqFactory)
return
}
示例3: TestClearTokens
func TestClearTokens(t *testing.T) {
org := cf.OrganizationFields{}
org.Name = "my-org"
space := cf.SpaceFields{}
space.Name = "my-space"
repo := NewConfigurationDiskRepository()
config := repo.loadDefaultConfig(t)
defer repo.restoreConfig(t)
config.Target = "http://api.example.com"
config.RefreshToken = "some old refresh token"
config.AccessToken = "some old access token"
config.OrganizationFields = org
config.SpaceFields = space
repo.Save()
err := repo.ClearTokens()
assert.NoError(t, err)
repo.Save()
savedConfig, err := repo.Get()
assert.NoError(t, err)
assert.Equal(t, savedConfig.Target, "http://api.example.com")
assert.Empty(t, savedConfig.AccessToken)
assert.Empty(t, savedConfig.RefreshToken)
assert.Equal(t, savedConfig.OrganizationFields, org)
assert.Equal(t, savedConfig.SpaceFields, space)
}
示例4: callListRoutes
func callListRoutes(t *testing.T, args []string, reqFactory *testreq.FakeReqFactory, routeRepo *testapi.FakeRouteRepository) (ui *testterm.FakeUI) {
ui = &testterm.FakeUI{}
ctxt := testcmd.NewContext("routes", args)
token, err := testconfig.CreateAccessTokenWithTokenInfo(configuration.TokenInfo{
Username: "my-user",
})
assert.NoError(t, err)
space := cf.SpaceFields{}
space.Name = "my-space"
org := cf.OrganizationFields{}
org.Name = "my-org"
config := &configuration.Configuration{
SpaceFields: space,
OrganizationFields: org,
AccessToken: token,
}
cmd := NewListRoutes(ui, config, routeRepo)
testcmd.RunCommand(cmd, ctxt, reqFactory)
return
}
示例5: callListQuotas
func callListQuotas(t *testing.T, reqFactory *testreq.FakeReqFactory, quotaRepo *testapi.FakeQuotaRepository) (fakeUI *testterm.FakeUI) {
fakeUI = &testterm.FakeUI{}
ctxt := testcmd.NewContext("quotas", []string{})
token, err := testconfig.CreateAccessTokenWithTokenInfo(configuration.TokenInfo{
Username: "my-user",
})
assert.NoError(t, err)
spaceFields := cf.SpaceFields{}
spaceFields.Name = "my-space"
orgFields := cf.OrganizationFields{}
orgFields.Name = "my-org"
config := &configuration.Configuration{
SpaceFields: spaceFields,
OrganizationFields: orgFields,
AccessToken: token,
}
cmd := organization.NewListQuotas(fakeUI, config, quotaRepo)
testcmd.RunCommand(cmd, ctxt, reqFactory)
return
}
示例6: deleteApp
func deleteApp(t *testing.T, confirmation string, args []string) (ui *testterm.FakeUI, reqFactory *testreq.FakeReqFactory, appRepo *testapi.FakeApplicationRepository) {
app := cf.Application{}
app.Name = "app-to-delete"
app.Guid = "app-to-delete-guid"
reqFactory = &testreq.FakeReqFactory{}
appRepo = &testapi.FakeApplicationRepository{ReadApp: app}
ui = &testterm.FakeUI{
Inputs: []string{confirmation},
}
token, err := testconfig.CreateAccessTokenWithTokenInfo(configuration.TokenInfo{
Username: "my-user",
})
assert.NoError(t, err)
org := cf.OrganizationFields{}
org.Name = "my-org"
space := cf.SpaceFields{}
space.Name = "my-space"
config := &configuration.Configuration{
SpaceFields: space,
OrganizationFields: org,
AccessToken: token,
}
ctxt := testcmd.NewContext("delete", args)
cmd := NewDeleteApp(ui, config, appRepo)
testcmd.RunCommand(cmd, ctxt, reqFactory)
return
}
示例7: callDomainMapper
func callDomainMapper(t *testing.T, shouldMap bool, args []string, reqFactory *testreq.FakeReqFactory, domainRepo *testapi.FakeDomainRepository) (ui *testterm.FakeUI) {
cmdName := "map-domain"
if !shouldMap {
cmdName = "unmap-domain"
}
ctxt := testcmd.NewContext(cmdName, args)
ui = &testterm.FakeUI{}
token, err := testconfig.CreateAccessTokenWithTokenInfo(configuration.TokenInfo{
Username: "my-user",
})
assert.NoError(t, err)
orgFields := cf.OrganizationFields{}
orgFields.Name = "my-org"
spaceFields := cf.SpaceFields{}
spaceFields.Name = "my-space"
config := &configuration.Configuration{
SpaceFields: spaceFields,
OrganizationFields: orgFields,
AccessToken: token,
}
cmd := domain.NewDomainMapper(ui, config, domainRepo, shouldMap)
testcmd.RunCommand(cmd, ctxt, reqFactory)
return
}
示例8: callDeleteDomain
func callDeleteDomain(t *testing.T, args []string, inputs []string, reqFactory *testreq.FakeReqFactory, domainRepo *testapi.FakeDomainRepository) (ui *testterm.FakeUI) {
ctxt := testcmd.NewContext("delete-domain", args)
ui = &testterm.FakeUI{
Inputs: inputs,
}
token, err := testconfig.CreateAccessTokenWithTokenInfo(configuration.TokenInfo{
Username: "my-user",
})
assert.NoError(t, err)
spaceFields := cf.SpaceFields{}
spaceFields.Name = "my-space"
orgFields := cf.OrganizationFields{}
orgFields.Name = "my-org"
config := &configuration.Configuration{
SpaceFields: spaceFields,
OrganizationFields: orgFields,
AccessToken: token,
}
cmd := domain.NewDeleteDomain(ui, config, domainRepo)
testcmd.RunCommand(cmd, ctxt, reqFactory)
return
}
示例9: deleteOrg
func deleteOrg(t *testing.T, confirmation string, args []string, orgRepo *testapi.FakeOrgRepository) (ui *testterm.FakeUI) {
reqFactory := &testreq.FakeReqFactory{}
configRepo := &testconfig.FakeConfigRepository{}
ui = &testterm.FakeUI{
Inputs: []string{confirmation},
}
ctxt := testcmd.NewContext("delete-org", args)
token, err := testconfig.CreateAccessTokenWithTokenInfo(configuration.TokenInfo{
Username: "my-user",
})
assert.NoError(t, err)
spaceFields := cf.SpaceFields{}
spaceFields.Name = "my-space"
orgFields := cf.OrganizationFields{}
orgFields.Name = "my-org"
config := &configuration.Configuration{
SpaceFields: spaceFields,
OrganizationFields: orgFields,
AccessToken: token,
}
cmd := NewDeleteOrg(ui, config, orgRepo, configRepo)
testcmd.RunCommand(cmd, ctxt, reqFactory)
return
}
示例10: TestDeleteTargetedOrganizationClearsConfig
func TestDeleteTargetedOrganizationClearsConfig(t *testing.T) {
configRepo := &testconfig.FakeConfigRepository{}
config, _ := configRepo.Get()
organizationFields := cf.OrganizationFields{}
organizationFields.Name = "org-to-delete"
organizationFields.Guid = "org-to-delete-guid"
config.OrganizationFields = organizationFields
spaceFields := cf.SpaceFields{}
spaceFields.Name = "space-to-delete"
config.SpaceFields = spaceFields
configRepo.Save()
org := cf.Organization{}
org.OrganizationFields = organizationFields
orgRepo := &testapi.FakeOrgRepository{FindByNameOrganization: org}
deleteOrg(t, "Yes", []string{"org-to-delete"}, orgRepo)
updatedConfig, err := configRepo.Get()
assert.NoError(t, err)
assert.Equal(t, updatedConfig.OrganizationFields, cf.OrganizationFields{})
assert.Equal(t, updatedConfig.SpaceFields, cf.SpaceFields{})
}
示例11: TestEmptyServicesList
func TestEmptyServicesList(t *testing.T) {
serviceInstances := []cf.ServiceInstance{}
serviceSummaryRepo := &testapi.FakeServiceSummaryRepo{
GetSummariesInCurrentSpaceInstances: serviceInstances,
}
ui := &testterm.FakeUI{}
token, err := testconfig.CreateAccessTokenWithTokenInfo(configuration.TokenInfo{
Username: "my-user",
})
assert.NoError(t, err)
org := cf.OrganizationFields{}
org.Name = "my-org"
space := cf.SpaceFields{}
space.Name = "my-space"
config := &configuration.Configuration{
SpaceFields: space,
OrganizationFields: org,
AccessToken: token,
}
cmd := NewListServices(ui, config, serviceSummaryRepo)
cmd.Run(testcmd.NewContext("services", []string{}))
testassert.SliceContains(t, ui.Outputs, testassert.Lines{
{"Getting services in org", "my-org", "my-space", "my-user"},
{"OK"},
{"No services found"},
})
testassert.SliceDoesNotContain(t, ui.Outputs, testassert.Lines{
{"name", "service", "plan", "bound apps"},
})
}
示例12: callRenameOrg
func callRenameOrg(t *testing.T, args []string, reqFactory *testreq.FakeReqFactory, orgRepo *testapi.FakeOrgRepository) (ui *testterm.FakeUI) {
ui = new(testterm.FakeUI)
ctxt := testcmd.NewContext("rename-org", args)
token, err := testconfig.CreateAccessTokenWithTokenInfo(configuration.TokenInfo{
Username: "my-user",
})
assert.NoError(t, err)
spaceFields := cf.SpaceFields{}
spaceFields.Name = "my-space"
orgFields := cf.OrganizationFields{}
orgFields.Name = "my-org"
config := &configuration.Configuration{
SpaceFields: spaceFields,
OrganizationFields: orgFields,
AccessToken: token,
}
cmd := organization.NewRenameOrg(ui, config, orgRepo)
testcmd.RunCommand(cmd, ctxt, reqFactory)
return
}
示例13: deleteWithConfirmation
func deleteWithConfirmation(t *testing.T, confirmation string) (ui *testterm.FakeUI, userRepo *testapi.FakeUserRepository) {
ui = &testterm.FakeUI{
Inputs: []string{confirmation},
}
user2 := cf.UserFields{}
user2.Username = "my-found-user"
user2.Guid = "my-found-user-guid"
userRepo = &testapi.FakeUserRepository{
FindByUsernameUserFields: user2,
}
token, err := testconfig.CreateAccessTokenWithTokenInfo(configuration.TokenInfo{
Username: "current-user",
})
assert.NoError(t, err)
org2 := cf.OrganizationFields{}
org2.Name = "my-org"
space2 := cf.SpaceFields{}
space2.Name = "my-space"
config := &configuration.Configuration{
SpaceFields: space2,
OrganizationFields: org2,
AccessToken: token,
}
cmd := NewDeleteUser(ui, config, userRepo)
ctxt := testcmd.NewContext("delete-user", []string{"my-user"})
reqFactory := &testreq.FakeReqFactory{LoginSuccess: true}
testcmd.RunCommand(cmd, ctxt, reqFactory)
return
}
示例14: TestUpdateEndpointWhenUrlIsValidHttpsInfoEndpoint
func TestUpdateEndpointWhenUrlIsValidHttpsInfoEndpoint(t *testing.T) {
configRepo := testconfig.FakeConfigRepository{}
configRepo.Delete()
configRepo.Login()
ts, repo := createEndpointRepoForUpdate(configRepo, validApiInfoEndpoint)
defer ts.Close()
org := cf.OrganizationFields{}
org.Name = "my-org"
org.Guid = "my-org-guid"
space := cf.SpaceFields{}
space.Name = "my-space"
space.Guid = "my-space-guid"
config, _ := configRepo.Get()
config.OrganizationFields = org
config.SpaceFields = space
repo.UpdateEndpoint(ts.URL)
savedConfig := testconfig.SavedConfiguration
assert.Equal(t, savedConfig.AccessToken, "")
assert.Equal(t, savedConfig.AuthorizationEndpoint, "https://login.example.com")
assert.Equal(t, savedConfig.Target, ts.URL)
assert.Equal(t, savedConfig.ApiVersion, "42.0.0")
assert.False(t, savedConfig.HasOrganization())
assert.False(t, savedConfig.HasSpace())
}
示例15: TestLogoutClearsAccessTokenOrgAndSpace
func TestLogoutClearsAccessTokenOrgAndSpace(t *testing.T) {
org := cf.OrganizationFields{}
org.Name = "MyOrg"
space := cf.SpaceFields{}
space.Name = "MySpace"
configRepo := &testconfig.FakeConfigRepository{}
config, _ := configRepo.Get()
config.AccessToken = "MyAccessToken"
config.OrganizationFields = org
config.SpaceFields = space
ui := new(testterm.FakeUI)
l := commands.NewLogout(ui, configRepo)
l.Run(nil)
updatedConfig, err := configRepo.Get()
assert.NoError(t, err)
assert.Empty(t, updatedConfig.AccessToken)
assert.Equal(t, updatedConfig.OrganizationFields, cf.OrganizationFields{})
assert.Equal(t, updatedConfig.SpaceFields, cf.SpaceFields{})
}