Exemple #1
0
				if !keepGoing {
					break
				}
			}
			return nil
		}
	}

	BeforeEach(func() {
		ui = new(testterm.FakeUI)
		orgRepo = new(organizationsfakes.FakeOrganizationRepository)
		spaceRepo = new(spacesfakes.FakeSpaceRepository)
		config = testconfig.NewRepository()
		requirementsFactory = new(requirementsfakes.FakeFactory)
		requirementsFactory.NewLoginRequirementReturns(requirements.Passing{})
		requirementsFactory.NewAPIEndpointRequirementReturns(requirements.Passing{})
	})

	var callTarget = func(args []string) bool {
		return testcmd.RunCLICommand("target", args, requirementsFactory, updateCommandDependency, false, ui)
	}

	Context("when there are too many arguments given", func() {
		var cmd commandregistry.Command
		var flagContext flags.FlagContext

		BeforeEach(func() {
			cmd = new(commands.Target)
			cmd.SetDependency(deps, false)
			flagContext = flags.NewFlagContext(cmd.MetaData().Flags)
		})
Exemple #2
0
		deps = commandregistry.Dependency{
			UI:          ui,
			Config:      configRepo,
			RepoLocator: repoLocator,
		}

		cmd = &commands.OneTimeSSHCode{}
		cmd.SetDependency(deps, false)

		flagContext = flags.NewFlagContext(cmd.MetaData().Flags)

		factory = new(requirementsfakes.FakeFactory)

		endpointRequirement = &passingRequirement{Name: "endpoint-requirement"}
		factory.NewAPIEndpointRequirementReturns(endpointRequirement)
	})

	Describe("Requirements", func() {
		It("returns an EndpointRequirement", func() {
			actualRequirements, err := cmd.Requirements(factory, flagContext)
			Expect(err).NotTo(HaveOccurred())
			Expect(factory.NewAPIEndpointRequirementCallCount()).To(Equal(1))
			Expect(actualRequirements).To(ContainElement(endpointRequirement))
		})

		Context("when not provided exactly zero args", func() {
			BeforeEach(func() {
				flagContext.Parse("domain-name")
			})