Esempio n. 1
1
func TestLoggingInWithTooManyOrgsDoesNotShowOrgList(t *testing.T) {
	c := LoginTestContext{
		Inputs: []string{"api.example.com", "*****@*****.**", "password", "my-org-1", "my-space"},
	}

	callLogin(t, &c, func(c *LoginTestContext) {
		for i := 0; i < 60; i++ {
			id := strconv.Itoa(i)
			org := cf.Organization{}
			org.Guid = "my-org-guid-" + id
			org.Name = "my-org-" + id
			c.orgRepo.Organizations = append(c.orgRepo.Organizations, org)
		}

		c.orgRepo.FindByNameOrganization = c.orgRepo.Organizations[1]

		space1 := cf.Space{}
		space1.Guid = "my-space-guid"
		space1.Name = "my-space"

		space2 := cf.Space{}
		space2.Guid = "some-space-guid"
		space2.Name = "some-space"

		c.spaceRepo.Spaces = []cf.Space{space1, space2}
	})

	savedConfig := testconfig.SavedConfiguration

	testassert.SliceDoesNotContain(t, c.ui.Outputs, testassert.Lines{
		{"my-org-2"},
	})
	assert.Equal(t, c.orgRepo.FindByNameName, "my-org-1")
	assert.Equal(t, savedConfig.OrganizationFields.Guid, "my-org-guid-1")
}
Esempio n. 2
0
func TestListAllPagesOfOrgs(t *testing.T) {
	org1 := cf.Organization{}
	org1.Name = "Organization-1"

	org2 := cf.Organization{}
	org2.Name = "Organization-2"

	org3 := cf.Organization{}
	org3.Name = "Organization-3"

	orgRepo := &testapi.FakeOrgRepository{
		Organizations: []cf.Organization{org1, org2, org3},
	}

	reqFactory := &testreq.FakeReqFactory{LoginSuccess: true}

	tokenInfo := configuration.TokenInfo{Username: "******"}
	accessToken, err := testconfig.CreateAccessTokenWithTokenInfo(tokenInfo)
	assert.NoError(t, err)
	config := &configuration.Configuration{AccessToken: accessToken}

	ui := callListOrgs(config, reqFactory, orgRepo)

	testassert.SliceContains(t, ui.Outputs, testassert.Lines{
		{"Getting orgs as my-user"},
		{"Organization-1"},
		{"Organization-2"},
		{"Organization-3"},
	})
}
Esempio n. 3
0
func TestSuccessfullyLoggingInWithNumericalPrompts(t *testing.T) {
	OUT_OF_RANGE_CHOICE := "3"
	c := LoginTestContext{
		Inputs: []string{"api.example.com", "*****@*****.**", "password", OUT_OF_RANGE_CHOICE, "2", OUT_OF_RANGE_CHOICE, "1"},
	}

	org1 := cf.Organization{}
	org1.Guid = "some-org-guid"
	org1.Name = "some-org"

	org2 := cf.Organization{}
	org2.Guid = "my-org-guid"
	org2.Name = "my-org"

	space1 := cf.Space{}
	space1.Guid = "my-space-guid"
	space1.Name = "my-space"

	space2 := cf.Space{}
	space2.Guid = "some-space-guid"
	space2.Name = "some-space"

	callLogin(t, &c, func(c *LoginTestContext) {
		c.orgRepo.Organizations = []cf.Organization{org1, org2}
		c.spaceRepo.Spaces = []cf.Space{space1, space2}
	})

	savedConfig := testconfig.SavedConfiguration

	expectedOutputs := testassert.Lines{
		testassert.Line{"Select an org:"},
		testassert.Line{"1. some-org"},
		testassert.Line{"2. my-org"},
		testassert.Line{"Select a space:"},
		testassert.Line{"1. my-space"},
		testassert.Line{"2. some-space"},
	}

	testassert.SliceContains(t, c.ui.Outputs, expectedOutputs)

	assert.Equal(t, savedConfig.Target, "api.example.com")
	assert.Equal(t, savedConfig.OrganizationFields.Guid, "my-org-guid")
	assert.Equal(t, savedConfig.SpaceFields.Guid, "my-space-guid")
	assert.Equal(t, savedConfig.AccessToken, "my_access_token")
	assert.Equal(t, savedConfig.RefreshToken, "my_refresh_token")

	assert.Equal(t, c.endpointRepo.UpdateEndpointReceived, "api.example.com")
	assert.Equal(t, c.authRepo.Email, "*****@*****.**")
	assert.Equal(t, c.authRepo.Password, "password")

	assert.Equal(t, c.orgRepo.FindByNameName, "my-org")
	assert.Equal(t, c.spaceRepo.FindByNameName, "my-space")

	assert.True(t, c.ui.ShowConfigurationCalled)
}
Esempio n. 4
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"},
	})
}
Esempio n. 5
0
func TestTargetOrganizationWhenUserHasAccess(t *testing.T) {
	orgRepo, spaceRepo, configRepo, reqFactory := getTargetDependencies()

	configRepo.Login()
	config, err := configRepo.Get()
	assert.NoError(t, err)

	config.SpaceFields = cf.SpaceFields{}
	config.SpaceFields.Name = "my-space"
	config.SpaceFields.Guid = "my-space-guid"

	org := cf.Organization{}
	org.Name = "my-organization"
	org.Guid = "my-organization-guid"

	orgRepo.Organizations = []cf.Organization{org}
	orgRepo.FindByNameOrganization = org

	ui := callTarget([]string{"-o", "my-organization"}, reqFactory, configRepo, orgRepo, spaceRepo)

	assert.Equal(t, orgRepo.FindByNameName, "my-organization")
	assert.True(t, ui.ShowConfigurationCalled)

	savedConfig := testconfig.SavedConfiguration
	assert.Equal(t, savedConfig.OrganizationFields.Guid, "my-organization-guid")
}
Esempio n. 6
0
func TestTargetOrganizationAndSpace(t *testing.T) {
	orgRepo, spaceRepo, configRepo, reqFactory := getTargetDependencies()
	configRepo.Delete()
	configRepo.Login()

	org := cf.Organization{}
	org.Name = "my-organization"
	org.Guid = "my-organization-guid"
	orgRepo.FindByNameOrganization = org

	space := cf.Space{}
	space.Name = "my-space"
	space.Guid = "my-space-guid"
	spaceRepo.FindByNameSpace = space

	ui := callTarget([]string{"-o", "my-organization", "-s", "my-space"}, reqFactory, configRepo, orgRepo, spaceRepo)

	savedConfig := testconfig.SavedConfiguration
	assert.True(t, ui.ShowConfigurationCalled)

	assert.Equal(t, orgRepo.FindByNameName, "my-organization")
	assert.Equal(t, savedConfig.OrganizationFields.Guid, "my-organization-guid")

	assert.Equal(t, spaceRepo.FindByNameName, "my-space")
	assert.Equal(t, savedConfig.SpaceFields.Guid, "my-space-guid")
}
Esempio n. 7
0
func TestSetSpaceRole(t *testing.T) {
	org := cf.Organization{}
	org.Guid = "my-org-guid"
	org.Name = "my-org"

	args := []string{"some-user", "some-org", "some-space", "SpaceManager"}

	reqFactory, spaceRepo, userRepo := getSetSpaceRoleDeps()
	reqFactory.LoginSuccess = true
	reqFactory.UserFields = cf.UserFields{}
	reqFactory.UserFields.Guid = "my-user-guid"
	reqFactory.UserFields.Username = "******"
	reqFactory.Organization = org

	spaceRepo.FindByNameInOrgSpace = cf.Space{}
	spaceRepo.FindByNameInOrgSpace.Guid = "my-space-guid"
	spaceRepo.FindByNameInOrgSpace.Name = "my-space"
	spaceRepo.FindByNameInOrgSpace.Organization = org.OrganizationFields

	ui := callSetSpaceRole(t, args, reqFactory, spaceRepo, userRepo)

	testassert.SliceContains(t, ui.Outputs, testassert.Lines{
		{"Assigning role ", "SpaceManager", "my-user", "my-org", "my-space", "current-user"},
		{"OK"},
	})

	assert.Equal(t, spaceRepo.FindByNameInOrgName, "some-space")
	assert.Equal(t, spaceRepo.FindByNameInOrgOrgGuid, "my-org-guid")

	assert.Equal(t, userRepo.SetSpaceRoleUserGuid, "my-user-guid")
	assert.Equal(t, userRepo.SetSpaceRoleSpaceGuid, "my-space-guid")
	assert.Equal(t, userRepo.SetSpaceRoleRole, cf.SPACE_MANAGER)
}
Esempio n. 8
0
func TestDeleteUntargetedOrganizationDoesNotClearConfig(t *testing.T) {
	org := cf.Organization{}
	org.Name = "org-to-delete"
	org.Guid = "org-to-delete-guid"
	orgRepo := &testapi.FakeOrgRepository{FindByNameOrganization: org}

	configRepo := &testconfig.FakeConfigRepository{}
	config, _ := configRepo.Get()
	otherOrgFields := cf.OrganizationFields{}
	otherOrgFields.Guid = "some-other-org-guid"
	otherOrgFields.Name = "some-other-org"
	config.OrganizationFields = otherOrgFields

	spaceFields := cf.SpaceFields{}
	spaceFields.Name = "some-other-space"
	config.SpaceFields = spaceFields
	configRepo.Save()

	deleteOrg(t, "Yes", []string{"org-to-delete"}, orgRepo)

	updatedConfig, err := configRepo.Get()
	assert.NoError(t, err)

	assert.Equal(t, updatedConfig.OrganizationFields.Name, "some-other-org")
	assert.Equal(t, updatedConfig.SpaceFields.Name, "some-other-space")
}
Esempio n. 9
0
func TestTargetOrganizationAndSpaceWhenSpaceFails(t *testing.T) {
	orgRepo, spaceRepo, configRepo, reqFactory := getTargetDependencies()
	configRepo.Delete()
	configRepo.Login()

	org := cf.Organization{}
	org.Name = "my-organization"
	org.Guid = "my-organization-guid"
	orgRepo.FindByNameOrganization = org

	spaceRepo.FindByNameErr = true

	ui := callTarget([]string{"-o", "my-organization", "-s", "my-space"}, reqFactory, configRepo, orgRepo, spaceRepo)

	savedConfig := testconfig.SavedConfiguration
	assert.True(t, ui.ShowConfigurationCalled)

	assert.Equal(t, orgRepo.FindByNameName, "my-organization")
	assert.Equal(t, savedConfig.OrganizationFields.Guid, "my-organization-guid")
	assert.Equal(t, spaceRepo.FindByNameName, "my-space")
	assert.Equal(t, savedConfig.SpaceFields.Guid, "")
	testassert.SliceContains(t, ui.Outputs, testassert.Lines{
		{"FAILED"},
		{"Unable to access space", "my-space"},
	})
}
Esempio n. 10
0
func TestUnsetOrgRole(t *testing.T) {
	userRepo := &testapi.FakeUserRepository{}
	user := cf.UserFields{}
	user.Username = "******"
	user.Guid = "some-user-guid"
	org := cf.Organization{}
	org.Name = "some-org"
	org.Guid = "some-org-guid"
	reqFactory := &testreq.FakeReqFactory{
		LoginSuccess: true,
		UserFields:   user,
		Organization: org,
	}
	args := []string{"my-username", "my-org", "OrgManager"}

	ui := callUnsetOrgRole(t, args, userRepo, reqFactory)

	testassert.SliceContains(t, ui.Outputs, testassert.Lines{
		{"Removing role", "OrgManager", "my-username", "my-org", "current-user"},
		{"OK"},
	})

	assert.Equal(t, userRepo.UnsetOrgRoleRole, cf.ORG_MANAGER)
	assert.Equal(t, userRepo.UnsetOrgRoleUserGuid, "some-user-guid")
	assert.Equal(t, userRepo.UnsetOrgRoleOrganizationGuid, "some-org-guid")
}
Esempio n. 11
0
func TestSuccessfullyLoggingInWithOnlyOneOrg(t *testing.T) {
	org := cf.Organization{}
	org.Name = "my-org"
	org.Guid = "my-org-guid"

	c := LoginTestContext{
		Flags:  []string{"-s", "my-space"},
		Inputs: []string{"http://api.example.com", "*****@*****.**", "password"},
	}

	callLogin(t, &c, func(c *LoginTestContext) {
		c.orgRepo.FindByNameOrganization = cf.Organization{}
		c.orgRepo.Organizations = []cf.Organization{org}
	})

	savedConfig := testconfig.SavedConfiguration

	assert.Equal(t, savedConfig.Target, "http://api.example.com")
	assert.Equal(t, savedConfig.OrganizationFields.Guid, "my-org-guid")
	assert.Equal(t, savedConfig.SpaceFields.Guid, "my-space-guid")
	assert.Equal(t, savedConfig.AccessToken, "my_access_token")
	assert.Equal(t, savedConfig.RefreshToken, "my_refresh_token")

	assert.Equal(t, c.endpointRepo.UpdateEndpointReceived, "http://api.example.com")
	assert.Equal(t, c.authRepo.Email, "*****@*****.**")
	assert.Equal(t, c.authRepo.Password, "password")

	assert.True(t, c.ui.ShowConfigurationCalled)
}
Esempio n. 12
0
func TestOrgReqExecute(t *testing.T) {
	org := cf.Organization{}
	org.Name = "my-org"
	org.Guid = "my-org-guid"
	orgRepo := &testapi.FakeOrgRepository{FindByNameOrganization: org}
	ui := new(testterm.FakeUI)

	orgReq := newOrganizationRequirement("foo", ui, orgRepo)
	success := orgReq.Execute()

	assert.True(t, success)
	assert.Equal(t, orgRepo.FindByNameName, "foo")
	assert.Equal(t, orgReq.GetOrganization(), org)
}
Esempio n. 13
0
func TestShowOrgFailsWithUsage(t *testing.T) {
	org := cf.Organization{}
	org.Name = "my-org"
	org.Guid = "my-org-guid"
	reqFactory := &testreq.FakeReqFactory{Organization: org, LoginSuccess: true}

	args := []string{"my-org"}
	ui := callShowOrg(t, args, reqFactory)
	assert.False(t, ui.FailedWithUsage)

	args = []string{}
	ui = callShowOrg(t, args, reqFactory)
	assert.True(t, ui.FailedWithUsage)
}
Esempio n. 14
0
func TestCreateDomain(t *testing.T) {
	org := cf.Organization{}
	org.Name = "myOrg"
	org.Guid = "myOrg-guid"
	reqFactory := &testreq.FakeReqFactory{LoginSuccess: true, Organization: org}
	domainRepo := &testapi.FakeDomainRepository{}
	ui := callCreateDomain(t, []string{"myOrg", "example.com"}, reqFactory, domainRepo)

	assert.Equal(t, domainRepo.CreateDomainName, "example.com")
	assert.Equal(t, domainRepo.CreateDomainOwningOrgGuid, "myOrg-guid")
	testassert.SliceContains(t, ui.Outputs, testassert.Lines{
		{"Creating domain", "example.com", "myOrg", "my-user"},
		{"OK"},
	})
}
Esempio n. 15
0
func TestDeleteOrgWithForceOption(t *testing.T) {
	org := cf.Organization{}
	org.Name = "org-to-delete"
	org.Guid = "org-to-delete-guid"
	orgRepo := &testapi.FakeOrgRepository{FindByNameOrganization: org}

	ui := deleteOrg(t, "Yes", []string{"-f", "org-to-delete"}, orgRepo)

	assert.Equal(t, len(ui.Prompts), 0)
	testassert.SliceContains(t, ui.Outputs, testassert.Lines{
		{"Deleting", "org-to-delete"},
		{"OK"},
	})
	assert.Equal(t, orgRepo.FindByNameName, "org-to-delete")
	assert.Equal(t, orgRepo.DeletedOrganizationGuid, "org-to-delete-guid")
}
Esempio n. 16
0
func TestOrganizationsFindByName(t *testing.T) {
	req := testapi.NewCloudControllerTestRequest(testnet.TestRequest{
		Method: "GET",
		Path:   "/v2/organizations?q=name%3Aorg1&inline-relations-depth=1",
		Response: testnet.TestResponse{Status: http.StatusOK, Body: `{"resources": [{
		  "metadata": { "guid": "org1-guid" },
		  "entity": {
			"name": "Org1",
			"quota_definition": {
			  "entity": {
			  	"name": "not-your-average-quota",
			    "memory_limit": 128
			  }
			},
			"spaces": [{
			  "metadata": { "guid": "space1-guid" },
			  "entity": { "name": "Space1" }
			}],
			"domains": [{
			  "metadata": { "guid": "domain1-guid" },
			  "entity": { "name": "cfapps.io" }
			}]
		  }
		}]}`},
	})

	ts, handler, repo := createOrganizationRepo(t, req)
	defer ts.Close()
	existingOrg := cf.Organization{}
	existingOrg.Guid = "org1-guid"
	existingOrg.Name = "Org1"

	org, apiResponse := repo.FindByName("Org1")
	assert.True(t, handler.AllRequestsCalled())
	assert.False(t, apiResponse.IsNotSuccessful())

	assert.Equal(t, org.Name, existingOrg.Name)
	assert.Equal(t, org.Guid, existingOrg.Guid)
	assert.Equal(t, org.QuotaDefinition.Name, "not-your-average-quota")
	assert.Equal(t, org.QuotaDefinition.MemoryLimit, uint64(128))
	assert.Equal(t, len(org.Spaces), 1)
	assert.Equal(t, org.Spaces[0].Name, "Space1")
	assert.Equal(t, org.Spaces[0].Guid, "space1-guid")
	assert.Equal(t, len(org.Domains), 1)
	assert.Equal(t, org.Domains[0].Name, "cfapps.io")
	assert.Equal(t, org.Domains[0].Guid, "domain1-guid")
}
Esempio n. 17
0
func TestRenameOrgRun(t *testing.T) {
	orgRepo := &testapi.FakeOrgRepository{}

	org := cf.Organization{}
	org.Name = "my-org"
	org.Guid = "my-org-guid"
	reqFactory := &testreq.FakeReqFactory{LoginSuccess: true, Organization: org}
	ui := callRenameOrg(t, []string{"my-org", "my-new-org"}, reqFactory, orgRepo)

	testassert.SliceContains(t, ui.Outputs, testassert.Lines{
		{"Renaming org", "my-org", "my-new-org", "my-user"},
		{"OK"},
	})

	assert.Equal(t, orgRepo.RenameOrganizationGuid, "my-org-guid")
	assert.Equal(t, orgRepo.RenameNewName, "my-new-org")
}
Esempio n. 18
0
func TestDeleteOrgConfirmingWithYes(t *testing.T) {
	org := cf.Organization{}
	org.Name = "org-to-delete"
	org.Guid = "org-to-delete-guid"
	orgRepo := &testapi.FakeOrgRepository{FindByNameOrganization: org}

	ui := deleteOrg(t, "Yes", []string{"org-to-delete"}, orgRepo)

	testassert.SliceContains(t, ui.Prompts, testassert.Lines{
		{"Really delete", "org-to-delete"},
	})
	testassert.SliceContains(t, ui.Outputs, testassert.Lines{
		{"Deleting org", "org-to-delete", "my-user"},
		{"OK"},
	})

	assert.Equal(t, orgRepo.FindByNameName, "org-to-delete")
	assert.Equal(t, orgRepo.DeletedOrganizationGuid, "org-to-delete-guid")
}
Esempio n. 19
0
func TestSpaceUsers(t *testing.T) {
	org := cf.Organization{}
	org.Name = "Org1"
	org.Guid = "org1-guid"
	space := cf.Space{}
	space.Name = "Space1"
	space.Guid = "space1-guid"

	reqFactory := &testreq.FakeReqFactory{LoginSuccess: true, Organization: org}
	spaceRepo := &testapi.FakeSpaceRepository{FindByNameInOrgSpace: space}
	userRepo := &testapi.FakeUserRepository{}

	user := cf.UserFields{}
	user.Username = "******"
	user2 := cf.UserFields{}
	user2.Username = "******"
	user3 := cf.UserFields{}
	user3.Username = "******"
	user4 := cf.UserFields{}
	user4.Username = "******"
	userRepo.ListUsersByRole = map[string][]cf.UserFields{
		cf.SPACE_MANAGER:   []cf.UserFields{user, user2},
		cf.SPACE_DEVELOPER: []cf.UserFields{user4},
		cf.SPACE_AUDITOR:   []cf.UserFields{user3},
	}

	ui := callSpaceUsers(t, []string{"my-org", "my-space"}, reqFactory, spaceRepo, userRepo)

	assert.Equal(t, spaceRepo.FindByNameInOrgName, "my-space")
	assert.Equal(t, spaceRepo.FindByNameInOrgOrgGuid, "org1-guid")
	assert.Equal(t, userRepo.ListUsersSpaceGuid, "space1-guid")

	testassert.SliceContains(t, ui.Outputs, testassert.Lines{
		{"Getting users in org", "Org1", "Space1", "my-user"},
		{"SPACE MANAGER"},
		{"user1"},
		{"user2"},
		{"SPACE DEVELOPER"},
		{"user4"},
		{"SPACE AUDITOR"},
		{"user3"},
	})
}
Esempio n. 20
0
func callLogin(t *testing.T, c *LoginTestContext, beforeBlock func(*LoginTestContext)) {

	c.configRepo = testconfig.FakeConfigRepository{}
	c.ui = &testterm.FakeUI{
		Inputs: c.Inputs,
	}
	c.authRepo = &testapi.FakeAuthenticationRepository{
		AccessToken:  "my_access_token",
		RefreshToken: "my_refresh_token",
		ConfigRepo:   c.configRepo,
	}
	c.endpointRepo = &testapi.FakeEndpointRepo{}

	org := cf.Organization{}
	org.Name = "my-org"
	org.Guid = "my-org-guid"

	c.orgRepo = &testapi.FakeOrgRepository{
		FindByNameOrganization: org,
	}

	space := cf.Space{}
	space.Name = "my-space"
	space.Guid = "my-space-guid"

	c.spaceRepo = &testapi.FakeSpaceRepository{
		FindByNameSpace: space,
	}

	c.configRepo.Delete()
	config, _ := c.configRepo.Get()
	config.Target = c.Config.Target
	config.OrganizationFields = c.Config.OrganizationFields
	config.SpaceFields = c.Config.SpaceFields

	beforeBlock(c)

	l := NewLogin(c.ui, c.configRepo, c.authRepo, c.endpointRepo, c.orgRepo, c.spaceRepo)
	l.Run(testcmd.NewContext("login", c.Flags))
}
Esempio n. 21
0
func TestSetQuota(t *testing.T) {
	org := cf.Organization{}
	org.Name = "my-org"
	org.Guid = "my-org-guid"

	quota := cf.QuotaFields{}
	quota.Name = "my-found-quota"
	quota.Guid = "my-quota-guid"

	quotaRepo := &testapi.FakeQuotaRepository{FindByNameQuota: quota}
	reqFactory := &testreq.FakeReqFactory{LoginSuccess: true, Organization: org}

	ui := callSetQuota(t, []string{"my-org", "my-quota"}, reqFactory, quotaRepo)

	assert.Equal(t, quotaRepo.FindByNameName, "my-quota")

	testassert.SliceContains(t, ui.Outputs, testassert.Lines{
		{"Setting quota", "my-found-quota", "my-org", "my-user"},
		{"OK"},
	})

	assert.Equal(t, quotaRepo.UpdateOrgGuid, "my-org-guid")
	assert.Equal(t, quotaRepo.UpdateQuotaGuid, "my-quota-guid")
}
Esempio n. 22
0
func getDomainMapperDeps() (reqFactory *testreq.FakeReqFactory, domainRepo *testapi.FakeDomainRepository) {
	domain := cf.Domain{}
	domain.Name = "foo.com"
	domain.Guid = "foo-guid"
	domainRepo = &testapi.FakeDomainRepository{
		FindByNameInOrgDomain: domain,
	}

	org := cf.Organization{}
	org.Name = "my-org"
	org.Guid = "my-org-guid"

	space := cf.Space{}
	space.Name = "my-space"
	space.Guid = "my-space-guid"

	reqFactory = &testreq.FakeReqFactory{
		LoginSuccess:       true,
		TargetedOrgSuccess: true,
		Organization:       org,
		Space:              space,
	}
	return
}