testterm "github.com/cloudfoundry/cli/testhelpers/terminal" . "github.com/cloudfoundry/cli/testhelpers/matchers" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("UnsetOrgRole", func() { var ( ui *testterm.FakeUI configRepo core_config.Repository userRepo *testapi.FakeUserRepository flagRepo *fakefeatureflagsapi.FakeFeatureFlagRepository cmd command_registry.Command deps command_registry.Dependency factory *fakerequirements.FakeFactory flagContext flags.FlagContext loginRequirement requirements.Requirement userRequirement *fakerequirements.FakeUserRequirement organizationRequirement *fakerequirements.FakeOrganizationRequirement ) BeforeEach(func() { ui = &testterm.FakeUI{} configRepo = testconfig.NewRepositoryWithDefaults() userRepo = &testapi.FakeUserRepository{} repoLocator := deps.RepoLocator.SetUserRepository(userRepo) flagRepo = &fakefeatureflagsapi.FakeFeatureFlagRepository{} repoLocator = repoLocator.SetFeatureFlagRepository(flagRepo)
testcmd "github.com/cloudfoundry/cli/testhelpers/commands" testconfig "github.com/cloudfoundry/cli/testhelpers/configuration" testreq "github.com/cloudfoundry/cli/testhelpers/requirements" testterm "github.com/cloudfoundry/cli/testhelpers/terminal" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" . "github.com/cloudfoundry/cli/testhelpers/matchers" ) var _ = Describe("unset-space-role command", func() { var ( ui *testterm.FakeUI configRepo core_config.Repository requirementsFactory *testreq.FakeReqFactory userRepo *testapi.FakeUserRepository spaceRepo *testapi.FakeSpaceRepository deps command_registry.Dependency ) updateCommandDependency := func(pluginCall bool) { deps.Ui = ui deps.Config = configRepo deps.RepoLocator = deps.RepoLocator.SetUserRepository(userRepo) deps.RepoLocator = deps.RepoLocator.SetSpaceRepository(spaceRepo) command_registry.Commands.SetCommand(command_registry.Commands.FindCommand("unset-space-role").SetDependency(deps, pluginCall)) } callUnsetSpaceRole := func(args []string, spaceRepo *testapi.FakeSpaceRepository, userRepo *testapi.FakeUserRepository, requirementsFactory *testreq.FakeReqFactory) (*testterm.FakeUI, bool) { ui = &testterm.FakeUI{} configRepo = testconfig.NewRepositoryWithDefaults()
"github.com/cloudfoundry/cli/plugin/models" testcmd "github.com/cloudfoundry/cli/testhelpers/commands" testconfig "github.com/cloudfoundry/cli/testhelpers/configuration" testreq "github.com/cloudfoundry/cli/testhelpers/requirements" testterm "github.com/cloudfoundry/cli/testhelpers/terminal" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" . "github.com/cloudfoundry/cli/testhelpers/matchers" ) var _ = Describe("space-users command", func() { var ( ui *testterm.FakeUI requirementsFactory *testreq.FakeReqFactory spaceRepo *testapi.FakeSpaceRepository userRepo *testapi.FakeUserRepository configRepo core_config.Repository deps command_registry.Dependency ) updateCommandDependency := func(pluginCall bool) { deps.Ui = ui deps.Config = configRepo deps.RepoLocator = deps.RepoLocator.SetUserRepository(userRepo) deps.RepoLocator = deps.RepoLocator.SetSpaceRepository(spaceRepo) command_registry.Commands.SetCommand(command_registry.Commands.FindCommand("space-users").SetDependency(deps, pluginCall)) } BeforeEach(func() { configRepo = testconfig.NewRepositoryWithDefaults()
"github.com/cloudfoundry/cli/cf/models" testcmd "github.com/cloudfoundry/cli/testhelpers/commands" testconfig "github.com/cloudfoundry/cli/testhelpers/configuration" testreq "github.com/cloudfoundry/cli/testhelpers/requirements" testterm "github.com/cloudfoundry/cli/testhelpers/terminal" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" . "github.com/cloudfoundry/cli/testhelpers/matchers" ) var _ = Describe("space-users command", func() { var ( ui *testterm.FakeUI requirementsFactory *testreq.FakeReqFactory spaceRepo *testapi.FakeSpaceRepository userRepo *testapi.FakeUserRepository config configuration.ReadWriter ) BeforeEach(func() { config = testconfig.NewRepositoryWithDefaults() ui = &testterm.FakeUI{} requirementsFactory = &testreq.FakeReqFactory{} spaceRepo = &testapi.FakeSpaceRepository{} userRepo = &testapi.FakeUserRepository{} }) runCommand := func(args ...string) { testcmd.RunCommand(NewSpaceUsers(ui, config, spaceRepo, userRepo), args, requirementsFactory) }
testapi "github.com/cloudfoundry/cli/cf/api/fakes" testconfig "github.com/cloudfoundry/cli/testhelpers/configuration" testreq "github.com/cloudfoundry/cli/testhelpers/requirements" testterm "github.com/cloudfoundry/cli/testhelpers/terminal" . "github.com/cloudfoundry/cli/testhelpers/matchers" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("SetSpaceRole", func() { var ( ui *testterm.FakeUI configRepo core_config.Repository userRepo *testapi.FakeUserRepository spaceRepo *testapi.FakeSpaceRepository cmd command_registry.Command requirementsFactory *testreq.FakeReqFactory flagContext flags.FlagContext ) BeforeEach(func() { ui = &testterm.FakeUI{} configRepo = testconfig.NewRepositoryWithDefaults() userRepo = &testapi.FakeUserRepository{} spaceRepo = &testapi.FakeSpaceRepository{} deps := command_registry.Dependency{} repoLocator := deps.RepoLocator repoLocator = repoLocator.SetUserRepository(userRepo) repoLocator = repoLocator.SetSpaceRepository(spaceRepo)
"errors" "github.com/cloudfoundry/cli/cf/models" "github.com/cloudfoundry/cli/cf/requirements" fakeapi "github.com/cloudfoundry/cli/cf/api/fakes" testterm "github.com/cloudfoundry/cli/testhelpers/terminal" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("UserRequirement", func() { var ( ui *testterm.FakeUI userRepo *fakeapi.FakeUserRepository userRequirement requirements.UserRequirement ) BeforeEach(func() { ui = new(testterm.FakeUI) userRepo = &fakeapi.FakeUserRepository{} }) Describe("Execute", func() { Context("when wantGuid is true", func() { BeforeEach(func() { userRequirement = requirements.NewUserRequirement("the-username", ui, userRepo, true) }) It("tries to find the user in CC", func() {
. "github.com/cloudfoundry/cli/cf/commands/user" "github.com/cloudfoundry/cli/cf/configuration/core_config" testcmd "github.com/cloudfoundry/cli/testhelpers/commands" testconfig "github.com/cloudfoundry/cli/testhelpers/configuration" testreq "github.com/cloudfoundry/cli/testhelpers/requirements" testterm "github.com/cloudfoundry/cli/testhelpers/terminal" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" . "github.com/cloudfoundry/cli/testhelpers/matchers" ) var _ = Describe("Create user command", func() { var ( requirementsFactory *testreq.FakeReqFactory ui *testterm.FakeUI userRepo *testapi.FakeUserRepository configRepo core_config.ReadWriter ) BeforeEach(func() { requirementsFactory = &testreq.FakeReqFactory{LoginSuccess: true} ui = new(testterm.FakeUI) userRepo = &testapi.FakeUserRepository{} configRepo = testconfig.NewRepositoryWithDefaults() accessToken, _ := testconfig.EncodeAccessToken(core_config.TokenInfo{ Username: "******", }) configRepo.SetAccessToken(accessToken) }) runCommand := func(args ...string) bool {
testterm "github.com/cloudfoundry/cli/testhelpers/terminal" . "github.com/cloudfoundry/cli/testhelpers/matchers" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" ) var _ = Describe("create-space command", func() { var ( ui *testterm.FakeUI requirementsFactory *testreq.FakeReqFactory configSpace models.SpaceFields configOrg models.OrganizationFields configRepo core_config.Repository spaceRepo *testapi.FakeSpaceRepository orgRepo *fake_org.FakeOrganizationRepository userRepo *testapi.FakeUserRepository spaceRoleSetter user.SpaceRoleSetter flagRepo *fakeflag.FakeFeatureFlagRepository spaceQuotaRepo *fakes.FakeSpaceQuotaRepository OriginalCommand command_registry.Command deps command_registry.Dependency ) updateCommandDependency := func(pluginCall bool) { deps.Ui = ui deps.RepoLocator = deps.RepoLocator.SetSpaceRepository(spaceRepo) deps.RepoLocator = deps.RepoLocator.SetSpaceQuotaRepository(spaceQuotaRepo) deps.RepoLocator = deps.RepoLocator.SetOrganizationRepository(orgRepo) deps.RepoLocator = deps.RepoLocator.SetFeatureFlagRepository(flagRepo) deps.RepoLocator = deps.RepoLocator.SetUserRepository(userRepo)
. "github.com/cloudfoundry/cli/cf/commands/user" "github.com/cloudfoundry/cli/cf/configuration" testcmd "github.com/cloudfoundry/cli/testhelpers/commands" testconfig "github.com/cloudfoundry/cli/testhelpers/configuration" testreq "github.com/cloudfoundry/cli/testhelpers/requirements" testterm "github.com/cloudfoundry/cli/testhelpers/terminal" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" . "github.com/cloudfoundry/cli/testhelpers/matchers" ) var _ = Describe("Create user command", func() { var ( requirementsFactory *testreq.FakeReqFactory ui *testterm.FakeUI userRepo *testapi.FakeUserRepository configRepo configuration.ReadWriter ) BeforeEach(func() { requirementsFactory = &testreq.FakeReqFactory{LoginSuccess: true} ui = new(testterm.FakeUI) userRepo = &testapi.FakeUserRepository{} configRepo = testconfig.NewRepositoryWithDefaults() accessToken, _ := testconfig.EncodeAccessToken(configuration.TokenInfo{ Username: "******", }) configRepo.SetAccessToken(accessToken) }) runCommand := func(args ...string) {
testcmd "github.com/cloudfoundry/cli/testhelpers/commands" testconfig "github.com/cloudfoundry/cli/testhelpers/configuration" testreq "github.com/cloudfoundry/cli/testhelpers/requirements" testterm "github.com/cloudfoundry/cli/testhelpers/terminal" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" . "github.com/cloudfoundry/cli/testhelpers/matchers" ) var _ = Describe("set-space-role command", func() { var ( ui *testterm.FakeUI requirementsFactory *testreq.FakeReqFactory spaceRepo *testapi.FakeSpaceRepository userRepo *testapi.FakeUserRepository configRepo core_config.Repository flagRepo *fakeflag.FakeFeatureFlagRepository deps command_registry.Dependency ) updateCommandDependency := func(pluginCall bool) { deps.Ui = ui deps.RepoLocator = deps.RepoLocator.SetSpaceRepository(spaceRepo) deps.RepoLocator = deps.RepoLocator.SetUserRepository(userRepo) deps.RepoLocator = deps.RepoLocator.SetFeatureFlagRepository(flagRepo) deps.Config = configRepo command_registry.Commands.SetCommand(command_registry.Commands.FindCommand("set-space-role").SetDependency(deps, pluginCall)) } BeforeEach(func() {
"github.com/cloudfoundry/cli/cf/models" testcmd "github.com/cloudfoundry/cli/testhelpers/commands" testconfig "github.com/cloudfoundry/cli/testhelpers/configuration" testreq "github.com/cloudfoundry/cli/testhelpers/requirements" testterm "github.com/cloudfoundry/cli/testhelpers/terminal" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" . "github.com/cloudfoundry/cli/testhelpers/matchers" ) var _ = Describe("unset-org-role command", func() { var ( ui *testterm.FakeUI userRepo *testapi.FakeUserRepository configRepo core_config.Repository requirementsFactory *testreq.FakeReqFactory deps command_registry.Dependency ) updateCommandDependency := func(pluginCall bool) { deps.Ui = ui deps.Config = configRepo deps.RepoLocator = deps.RepoLocator.SetUserRepository(userRepo) command_registry.Commands.SetCommand(command_registry.Commands.FindCommand("unset-org-role").SetDependency(deps, pluginCall)) } runCommand := func(args ...string) bool { return testcmd.RunCliCommand("unset-org-role", args, requirementsFactory, updateCommandDependency, false) }
testcmd "github.com/cloudfoundry/cli/testhelpers/commands" testconfig "github.com/cloudfoundry/cli/testhelpers/configuration" testreq "github.com/cloudfoundry/cli/testhelpers/requirements" testterm "github.com/cloudfoundry/cli/testhelpers/terminal" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" "github.com/cloudfoundry/cli/cf/command_registry" . "github.com/cloudfoundry/cli/testhelpers/matchers" ) var _ = Describe("Create user command", func() { var ( requirementsFactory *testreq.FakeReqFactory ui *testterm.FakeUI userRepo *testapi.FakeUserRepository config core_config.Repository deps command_registry.Dependency ) BeforeEach(func() { requirementsFactory = &testreq.FakeReqFactory{LoginSuccess: true} ui = new(testterm.FakeUI) userRepo = &testapi.FakeUserRepository{} config = testconfig.NewRepositoryWithDefaults() accessToken, _ := testconfig.EncodeAccessToken(core_config.TokenInfo{ Username: "******", }) config.SetAccessToken(accessToken) })
"github.com/cloudfoundry/cli/cf/models" testcmd "github.com/cloudfoundry/cli/testhelpers/commands" testconfig "github.com/cloudfoundry/cli/testhelpers/configuration" testreq "github.com/cloudfoundry/cli/testhelpers/requirements" testterm "github.com/cloudfoundry/cli/testhelpers/terminal" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" . "github.com/cloudfoundry/cli/testhelpers/matchers" ) var _ = Describe("delete-user command", func() { var ( ui *testterm.FakeUI configRepo core_config.Repository userRepo *testapi.FakeUserRepository requirementsFactory *testreq.FakeReqFactory deps command_registry.Dependency ) updateCommandDependency := func(pluginCall bool) { deps.Ui = ui deps.Config = configRepo deps.RepoLocator = deps.RepoLocator.SetUserRepository(userRepo) command_registry.Commands.SetCommand(command_registry.Commands.FindCommand("delete-user").SetDependency(deps, pluginCall)) } BeforeEach(func() { ui = &testterm.FakeUI{Inputs: []string{"y"}} userRepo = &testapi.FakeUserRepository{} requirementsFactory = &testreq.FakeReqFactory{LoginSuccess: true}
"github.com/cloudfoundry/cli/cf/configuration" "github.com/cloudfoundry/cli/cf/models" testcmd "github.com/cloudfoundry/cli/testhelpers/commands" testconfig "github.com/cloudfoundry/cli/testhelpers/configuration" testreq "github.com/cloudfoundry/cli/testhelpers/requirements" testterm "github.com/cloudfoundry/cli/testhelpers/terminal" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" . "github.com/cloudfoundry/cli/testhelpers/matchers" ) var _ = Describe("delete-user command", func() { var ( ui *testterm.FakeUI configRepo configuration.ReadWriter userRepo *testapi.FakeUserRepository requirementsFactory *testreq.FakeReqFactory ) BeforeEach(func() { ui = &testterm.FakeUI{Inputs: []string{"y"}} userRepo = &testapi.FakeUserRepository{} requirementsFactory = &testreq.FakeReqFactory{LoginSuccess: true} configRepo = testconfig.NewRepositoryWithDefaults() token, err := testconfig.EncodeAccessToken(configuration.TokenInfo{ UserGuid: "admin-user-guid", Username: "******", }) Expect(err).ToNot(HaveOccurred()) configRepo.SetAccessToken(token)
"github.com/cloudfoundry/cli/plugin/models" testcmd "github.com/cloudfoundry/cli/testhelpers/commands" testconfig "github.com/cloudfoundry/cli/testhelpers/configuration" testreq "github.com/cloudfoundry/cli/testhelpers/requirements" testterm "github.com/cloudfoundry/cli/testhelpers/terminal" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" . "github.com/cloudfoundry/cli/testhelpers/matchers" ) var _ = Describe("org-users command", func() { var ( ui *testterm.FakeUI requirementsFactory *testreq.FakeReqFactory configRepo core_config.Repository userRepo *testapi.FakeUserRepository deps command_registry.Dependency ) updateCommandDependency := func(pluginCall bool) { deps.Ui = ui deps.Config = configRepo deps.RepoLocator = deps.RepoLocator.SetUserRepository(userRepo) command_registry.Commands.SetCommand(command_registry.Commands.FindCommand("org-users").SetDependency(deps, pluginCall)) } BeforeEach(func() { ui = &testterm.FakeUI{} userRepo = &testapi.FakeUserRepository{}
"github.com/cloudfoundry/cli/cf/configuration" "github.com/cloudfoundry/cli/cf/models" testcmd "github.com/cloudfoundry/cli/testhelpers/commands" testconfig "github.com/cloudfoundry/cli/testhelpers/configuration" testreq "github.com/cloudfoundry/cli/testhelpers/requirements" testterm "github.com/cloudfoundry/cli/testhelpers/terminal" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" . "github.com/cloudfoundry/cli/testhelpers/matchers" ) var _ = Describe("org-users command", func() { var ( ui *testterm.FakeUI requirementsFactory *testreq.FakeReqFactory configRepo configuration.ReadWriter userRepo *testapi.FakeUserRepository ) BeforeEach(func() { ui = &testterm.FakeUI{} userRepo = &testapi.FakeUserRepository{} configRepo = testconfig.NewRepositoryWithDefaults() requirementsFactory = &testreq.FakeReqFactory{} }) runCommand := func(args ...string) { testcmd.RunCommand(NewOrgUsers(ui, configRepo, userRepo), args, requirementsFactory) } Describe("requirements", func() {