本文整理匯總了Golang中cf.DomainFields.Guid方法的典型用法代碼示例。如果您正苦於以下問題:Golang DomainFields.Guid方法的具體用法?Golang DomainFields.Guid怎麽用?Golang DomainFields.Guid使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類cf.DomainFields
的用法示例。
在下文中一共展示了DomainFields.Guid方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: TestCreateRoute
func TestCreateRoute(t *testing.T) {
space := cf.SpaceFields{}
space.Guid = "my-space-guid"
space.Name = "my-space"
domain := cf.DomainFields{}
domain.Guid = "domain-guid"
domain.Name = "example.com"
reqFactory := &testreq.FakeReqFactory{
LoginSuccess: true,
TargetedOrgSuccess: true,
Domain: cf.Domain{DomainFields: domain},
Space: cf.Space{SpaceFields: space},
}
routeRepo := &testapi.FakeRouteRepository{}
ui := callCreateRoute(t, []string{"-n", "host", "my-space", "example.com"}, reqFactory, routeRepo)
testassert.SliceContains(t, ui.Outputs, testassert.Lines{
{"Creating route", "host.example.com", "my-org", "my-space", "my-user"},
{"OK"},
})
assert.Equal(t, routeRepo.CreateInSpaceHost, "host")
assert.Equal(t, routeRepo.CreateInSpaceDomainGuid, "domain-guid")
assert.Equal(t, routeRepo.CreateInSpaceSpaceGuid, "my-space-guid")
}
示例2: TestPushingAppWhenItAlreadyExistsAndDomainIsSpecifiedIsAlreadyBound
func TestPushingAppWhenItAlreadyExistsAndDomainIsSpecifiedIsAlreadyBound(t *testing.T) {
deps := getPushDependencies()
domain := cf.DomainFields{}
domain.Name = "example.com"
domain.Guid = "domain-guid"
existingRoute := cf.RouteSummary{}
existingRoute.Host = "existing-app"
existingRoute.Domain = domain
existingApp := cf.Application{}
existingApp.Name = "existing-app"
existingApp.Guid = "existing-app-guid"
existingApp.Routes = []cf.RouteSummary{existingRoute}
foundRoute := cf.Route{}
foundRoute.RouteFields = existingRoute.RouteFields
foundRoute.Domain = existingRoute.Domain
deps.appRepo.ReadApp = existingApp
deps.appRepo.UpdateAppResult = existingApp
deps.routeRepo.FindByHostAndDomainRoute = foundRoute
ui := callPush(t, []string{"-d", "example.com", "existing-app"}, deps)
testassert.SliceContains(t, ui.Outputs, testassert.Lines{
{"Using route", "existing-app", "example.com"},
})
assert.Equal(t, deps.appBitsRepo.UploadedAppGuid, "existing-app-guid")
}
示例3: TestDeleteRouteWithConfirmation
func TestDeleteRouteWithConfirmation(t *testing.T) {
domain := cf.DomainFields{}
domain.Guid = "domain-guid"
domain.Name = "example.com"
reqFactory := &testreq.FakeReqFactory{LoginSuccess: true}
route := cf.Route{}
route.Guid = "route-guid"
route.Host = "my-host"
route.Domain = domain
routeRepo := &testapi.FakeRouteRepository{
FindByHostAndDomainRoute: route,
}
ui := callDeleteRoute(t, "y", []string{"-n", "my-host", "example.com"}, reqFactory, routeRepo)
testassert.SliceContains(t, ui.Prompts, testassert.Lines{
{"Really delete", "my-host"},
})
testassert.SliceContains(t, ui.Outputs, testassert.Lines{
{"Deleting route", "my-host.example.com"},
{"OK"},
})
assert.Equal(t, routeRepo.DeleteRouteGuid, "route-guid")
}
示例4: ToModel
func (resource RouteSummary) ToModel() (route cf.RouteSummary) {
domain := cf.DomainFields{}
domain.Guid = resource.Domain.Guid
domain.Name = resource.Domain.Name
domain.Shared = resource.Domain.OwningOrganizationGuid != ""
route.Guid = resource.Guid
route.Host = resource.Host
route.Domain = domain
return
}
示例5: TestRouteCreator
func TestRouteCreator(t *testing.T) {
space := cf.SpaceFields{}
space.Guid = "my-space-guid"
space.Name = "my-space"
domain := cf.DomainFields{}
domain.Guid = "domain-guid"
domain.Name = "example.com"
createdRoute := cf.Route{}
createdRoute.Host = "my-host"
createdRoute.Guid = "my-route-guid"
routeRepo := &testapi.FakeRouteRepository{
CreateInSpaceCreatedRoute: createdRoute,
}
ui := new(testterm.FakeUI)
token, err := testconfig.CreateAccessTokenWithTokenInfo(configuration.TokenInfo{
Username: "my-user",
})
assert.NoError(t, err)
org := cf.OrganizationFields{}
org.Name = "my-org"
config := &configuration.Configuration{
OrganizationFields: org,
AccessToken: token,
}
cmd := NewCreateRoute(ui, config, routeRepo)
route, apiResponse := cmd.CreateRoute("my-host", domain, space)
assert.Equal(t, route.Guid, createdRoute.Guid)
assert.True(t, apiResponse.IsSuccessful())
testassert.SliceContains(t, ui.Outputs, testassert.Lines{
{"Creating route", "my-host.example.com", "my-org", "my-space", "my-user"},
{"OK"},
})
assert.Equal(t, routeRepo.CreateInSpaceHost, "my-host")
assert.Equal(t, routeRepo.CreateInSpaceDomainGuid, "domain-guid")
assert.Equal(t, routeRepo.CreateInSpaceSpaceGuid, "my-space-guid")
}
示例6: TestShowSpaceInfoSuccess
func TestShowSpaceInfoSuccess(t *testing.T) {
org := cf.OrganizationFields{}
org.Name = "my-org"
app := cf.ApplicationFields{}
app.Name = "app1"
app.Guid = "app1-guid"
apps := []cf.ApplicationFields{app}
domain := cf.DomainFields{}
domain.Name = "domain1"
domain.Guid = "domain1-guid"
domains := []cf.DomainFields{domain}
serviceInstance := cf.ServiceInstanceFields{}
serviceInstance.Name = "service1"
serviceInstance.Guid = "service1-guid"
services := []cf.ServiceInstanceFields{serviceInstance}
space := cf.Space{}
space.Name = "space1"
space.Organization = org
space.Applications = apps
space.Domains = domains
space.ServiceInstances = services
reqFactory := &testreq.FakeReqFactory{LoginSuccess: true, TargetedOrgSuccess: true, Space: space}
ui := callShowSpace(t, []string{"space1"}, reqFactory)
testassert.SliceContains(t, ui.Outputs, testassert.Lines{
{"Getting info for space", "space1", "my-org", "my-user"},
{"OK"},
{"space1"},
{"Org", "my-org"},
{"Apps", "app1"},
{"Domains", "domain1"},
{"Services", "service1"},
})
}
示例7: TestCreateRouteIsIdempotent
func TestCreateRouteIsIdempotent(t *testing.T) {
space := cf.SpaceFields{}
space.Guid = "my-space-guid"
space.Name = "my-space"
domain := cf.DomainFields{}
domain.Guid = "domain-guid"
domain.Name = "example.com"
reqFactory := &testreq.FakeReqFactory{
LoginSuccess: true,
TargetedOrgSuccess: true,
Domain: cf.Domain{DomainFields: domain},
Space: cf.Space{SpaceFields: space},
}
route := cf.Route{}
route.Guid = "my-route-guid"
route.Host = "host"
route.Domain = domain
route.Space = space
routeRepo := &testapi.FakeRouteRepository{
CreateInSpaceErr: true,
FindByHostAndDomainRoute: route,
}
ui := callCreateRoute(t, []string{"-n", "host", "my-space", "example.com"}, reqFactory, routeRepo)
testassert.SliceContains(t, ui.Outputs, testassert.Lines{
{"Creating route"},
{"OK"},
{"host.example.com", "already exists"},
})
assert.Equal(t, routeRepo.CreateInSpaceHost, "host")
assert.Equal(t, routeRepo.CreateInSpaceDomainGuid, "domain-guid")
assert.Equal(t, routeRepo.CreateInSpaceSpaceGuid, "my-space-guid")
}