func TestListingRoutes(t *testing.T) { domain := cf.DomainFields{} domain.Name = "example.com" domain2 := cf.DomainFields{} domain2.Name = "cfapps.com" domain3 := cf.DomainFields{} domain3.Name = "another-example.com" app1 := cf.ApplicationFields{} app1.Name = "dora" app2 := cf.ApplicationFields{} app2.Name = "dora2" app3 := cf.ApplicationFields{} app3.Name = "my-app" app4 := cf.ApplicationFields{} app4.Name = "my-app2" app5 := cf.ApplicationFields{} app5.Name = "july" route := cf.Route{} route.Host = "hostname-1" route.Domain = domain route.Apps = []cf.ApplicationFields{app1, app2} route2 := cf.Route{} route2.Host = "hostname-2" route2.Domain = domain2 route2.Apps = []cf.ApplicationFields{app3, app4} route3 := cf.Route{} route3.Host = "hostname-3" route3.Domain = domain3 route3.Apps = []cf.ApplicationFields{app5} routes := []cf.Route{route, route2, route3} routeRepo := &testapi.FakeRouteRepository{Routes: routes} ui := callListRoutes(t, []string{}, &testreq.FakeReqFactory{}, routeRepo) testassert.SliceContains(t, ui.Outputs, testassert.Lines{ {"Getting routes", "my-user"}, {"host", "domain", "apps"}, {"hostname-1", "example.com", "dora", "dora2"}, {"hostname-2", "cfapps.com", "my-app", "my-app2"}, {"hostname-3", "another-example.com", "july"}, }) }
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"}, }) }