Esempio n. 1
0
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"},
	})
}