func TestMarketplaceServices(t *testing.T) { plan := cf.ServicePlanFields{} plan.Name = "service-plan-a" plan2 := cf.ServicePlanFields{} plan2.Name = "service-plan-b" plan3 := cf.ServicePlanFields{} plan3.Name = "service-plan-c" plan4 := cf.ServicePlanFields{} plan4.Name = "service-plan-d" offering := cf.ServiceOffering{} offering.Label = "zzz-my-service-offering" offering.Description = "service offering 1 description" offering.Plans = []cf.ServicePlanFields{plan, plan2} offering2 := cf.ServiceOffering{} offering2.Label = "aaa-my-service-offering" offering2.Description = "service offering 2 description" offering2.Plans = []cf.ServicePlanFields{plan3, plan4} serviceOfferings := []cf.ServiceOffering{offering, offering2} serviceRepo := &testapi.FakeServiceRepo{ServiceOfferings: serviceOfferings} token, err := testconfig.CreateAccessTokenWithTokenInfo(configuration.TokenInfo{ Username: "******", }) assert.NoError(t, err) 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 := &configuration.Configuration{ SpaceFields: space, OrganizationFields: org, AccessToken: token, } ui := callMarketplaceServices(t, config, serviceRepo) testassert.SliceContains(t, ui.Outputs, testassert.Lines{ {"Getting services from marketplace in org", "my-org", "my-space", "my-user"}, {"OK"}, {"service", "plans", "description"}, {"aaa-my-service-offering", "service offering 2 description", "service-plan-c", "service-plan-d"}, {"zzz-my-service-offering", "service offering 1 description", "service-plan-a", "service-plan-b"}, }) }