{"Assigning", "my-user", "my-space", models.SpaceRoleToUserInput[models.SPACE_MANAGER]}, {"Assigning", "my-user", "my-space", models.SpaceRoleToUserInput[models.SPACE_DEVELOPER]}, {"TIP"}, }) Expect(defaultSpaceRepo.CreateSpaceName).To(Equal("my-space")) Expect(defaultSpaceRepo.CreateSpaceOrgGuid).To(Equal(org.Guid)) Expect(defaultUserRepo.SetSpaceRoleUserGuid).To(Equal("my-user-guid")) Expect(defaultUserRepo.SetSpaceRoleSpaceGuid).To(Equal("my-space-guid")) Expect(defaultUserRepo.SetSpaceRoleRole).To(Equal(models.SPACE_DEVELOPER)) }) It("TestCreateSpaceInOrgWhenTheOrgDoesNotExist", func() { resetSpaceDefaults() defaultOrgRepo.FindByNameNotFound = true ui := callCreateSpace([]string{"-o", "cool-organization", "my-space"}, defaultReqFactory, defaultSpaceRepo, defaultOrgRepo, defaultUserRepo) testassert.SliceContains(ui.Outputs, testassert.Lines{ {"FAILED"}, {"cool-organization", "does not exist"}, }) Expect(defaultSpaceRepo.CreateSpaceName).To(Equal("")) }) It("TestCreateSpaceInOrgWhenErrorFindingOrg", func() { resetSpaceDefaults() defaultOrgRepo.FindByNameErr = true
Expect(ui.ShowConfigurationCalled).To(BeTrue()) Expect(config.OrganizationFields().Guid).To(Equal("my-organization-guid")) }) It("TestTargetOrganizationWhenUserDoesNotHaveAccess", func() { orgs := []models.Organization{} orgRepo.Organizations = orgs orgRepo.FindByNameErr = true ui := callTarget([]string{"-o", "my-organization"}, reqFactory, config, orgRepo, spaceRepo) testassert.SliceContains(ui.Outputs, testassert.Lines{{"FAILED"}}) }) It("TestTargetOrganizationWhenOrgNotFound", func() { orgRepo.FindByNameNotFound = true ui := callTarget([]string{"-o", "my-organization"}, reqFactory, config, orgRepo, spaceRepo) testassert.SliceContains(ui.Outputs, testassert.Lines{ {"FAILED"}, {"my-organization", "not found"}, }) }) It("TestTargetSpaceWhenNoOrganizationIsSelected", func() { config.SetOrganizationFields(models.OrganizationFields{}) ui := callTarget([]string{"-s", "my-space"}, reqFactory, config, orgRepo, spaceRepo) testassert.SliceContains(ui.Outputs, testassert.Lines{