本文整理匯總了Golang中github.com/cloudfoundry/cli/cf/requirements/requirementsfakes.FakeRequirement類的典型用法代碼示例。如果您正苦於以下問題:Golang FakeRequirement類的具體用法?Golang FakeRequirement怎麽用?Golang FakeRequirement使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了FakeRequirement類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1:
"github.com/cloudfoundry/cli/cf/api"
"github.com/cloudfoundry/cli/cf/commands/space"
"github.com/cloudfoundry/cli/cf/models"
"github.com/cloudfoundry/cli/cf/requirements"
"github.com/cloudfoundry/cli/cf/requirements/requirementsfakes"
"github.com/cloudfoundry/cli/flags"
. "github.com/cloudfoundry/cli/testhelpers/matchers"
)
var _ = Describe("space command", func() {
var (
ui *testterm.FakeUI
loginReq *requirementsfakes.FakeRequirement
targetedOrgReq *requirementsfakes.FakeTargetedOrgRequirement
reqFactory *requirementsfakes.FakeFactory
deps commandregistry.Dependency
cmd space.ShowSpace
flagContext flags.FlagContext
getSpaceModel *plugin_models.GetSpace_Model
spaceRequirement *requirementsfakes.FakeSpaceRequirement
quotaRepo *spacequotasfakes.FakeSpaceQuotaRepository
)
BeforeEach(func() {
ui = new(testterm.FakeUI)
quotaRepo = new(spacequotasfakes.FakeSpaceQuotaRepository)
repoLocator := api.RepositoryLocator{}
repoLocator = repoLocator.SetSpaceQuotaRepository(quotaRepo)
getSpaceModel = new(plugin_models.GetSpace_Model)
deps = commandregistry.Dependency{
UI: ui,
示例2:
"github.com/cloudfoundry/cli/cf/commands/spacequota"
"github.com/cloudfoundry/cli/cf/flags"
. "github.com/cloudfoundry/cli/testhelpers/matchers"
. "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{}
示例3:
package requirements_test
import (
. "github.com/cloudfoundry/cli/cf/requirements"
"errors"
"github.com/cloudfoundry/cli/cf/requirements/requirementsfakes"
. "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))