示例#1
0
	testterm "code.cloudfoundry.org/cli/testhelpers/terminal"

	"code.cloudfoundry.org/cli/cf/api"
	"code.cloudfoundry.org/cli/cf/commands/organization"
	"code.cloudfoundry.org/cli/cf/requirements/requirementsfakes"
	. "code.cloudfoundry.org/cli/testhelpers/matchers"
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

var _ = Describe("org command", func() {
	var (
		ui             *testterm.FakeUI
		getOrgModel    *plugin_models.GetOrg_Model
		deps           commandregistry.Dependency
		reqFactory     *requirementsfakes.FakeFactory
		loginReq       *requirementsfakes.FakeRequirement
		orgRequirement *requirementsfakes.FakeOrganizationRequirement
		cmd            organization.ShowOrg
		flagContext    flags.FlagContext
	)

	BeforeEach(func() {
		ui = new(testterm.FakeUI)
		getOrgModel = new(plugin_models.GetOrg_Model)

		deps = commandregistry.Dependency{
			UI:          ui,
			Config:      testconfig.NewRepositoryWithDefaults(),
			RepoLocator: api.RepositoryLocator{},
			PluginModels: &commandregistry.PluginModels{
				Organization: getOrgModel,
package requirements_test

import (
	. "code.cloudfoundry.org/cli/cf/requirements"

	"errors"

	"code.cloudfoundry.org/cli/cf/requirements/requirementsfakes"
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

var _ = Describe("ConfigRefreshingRequirement", func() {
	var (
		r                     Requirement
		underlyingRequirement *requirementsfakes.FakeRequirement
		configRefresher       *requirementsfakes.FakeConfigRefresher
	)

	BeforeEach(func() {
		underlyingRequirement = new(requirementsfakes.FakeRequirement)
		configRefresher = new(requirementsfakes.FakeConfigRefresher)
		r = NewConfigRefreshingRequirement(underlyingRequirement, configRefresher)
	})

	Describe("Execute", func() {
		It("tries to execute the underlying requirement", func() {
			underlyingRequirement.ExecuteReturns(nil)

			r.Execute()
示例#3
0
	"code.cloudfoundry.org/cli/cf/flags"
	. "code.cloudfoundry.org/cli/testhelpers/matchers"
	"github.com/blang/semver"
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

var _ = Describe("create-space-quota", func() {
	var (
		ui                  *testterm.FakeUI
		quotaRepo           *spacequotasfakes.FakeSpaceQuotaRepository
		requirementsFactory *requirementsfakes.FakeFactory
		config              *coreconfigfakes.FakeRepository

		loginReq         *requirementsfakes.FakeRequirement
		targetedOrgReq   *requirementsfakes.FakeTargetedOrgRequirement
		minApiVersionReq *requirementsfakes.FakeRequirement
		reqFactory       *requirementsfakes.FakeFactory

		deps        commandregistry.Dependency
		cmd         spacequota.CreateSpaceQuota
		flagContext flags.FlagContext
	)

	BeforeEach(func() {
		ui = &testterm.FakeUI{}
		quotaRepo = new(spacequotasfakes.FakeSpaceQuotaRepository)
		requirementsFactory = new(requirementsfakes.FakeFactory)
		config = new(coreconfigfakes.FakeRepository)

		repoLocator := api.RepositoryLocator{}
示例#4
0
package requirements_test

import (
	. "code.cloudfoundry.org/cli/cf/requirements"

	"code.cloudfoundry.org/cli/cf/requirements/requirementsfakes"
	"errors"
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

var _ = Describe("Requirements", func() {
	Context("When there are multiple requirements", func() {
		It("executes all the requirements", func() {
			r1 := new(requirementsfakes.FakeRequirement)
			r1.ExecuteReturns(nil)
			r2 := new(requirementsfakes.FakeRequirement)
			r2.ExecuteReturns(nil)

			// SETUP
			requirements := Requirements{
				r1,
				r2,
			}

			// EXECUTE
			err := requirements.Execute()

			// ASSERT
			Expect(err).NotTo(HaveOccurred())
			Expect(r1.ExecuteCallCount()).To(Equal(1))