本文整理匯總了Golang中code/cloudfoundry/org/cli/cf/api/organizations/organizationsfakes.FakeOrganizationRepository類的典型用法代碼示例。如果您正苦於以下問題:Golang FakeOrganizationRepository類的具體用法?Golang FakeOrganizationRepository怎麽用?Golang FakeOrganizationRepository使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了FakeOrganizationRepository類的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1:
package requirements_test
import (
"errors"
"code.cloudfoundry.org/cli/cf/api/organizations/organizationsfakes"
"code.cloudfoundry.org/cli/cf/models"
. "code.cloudfoundry.org/cli/cf/requirements"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("OrganizationRequirement", func() {
var orgRepo *organizationsfakes.FakeOrganizationRepository
BeforeEach(func() {
orgRepo = new(organizationsfakes.FakeOrganizationRepository)
})
Context("when an org with the given name exists", func() {
It("succeeds", func() {
org := models.Organization{}
org.Name = "my-org-name"
org.GUID = "my-org-guid"
orgReq := NewOrganizationRequirement("my-org-name", orgRepo)
orgRepo.ListOrgsReturns([]models.Organization{org}, nil)
orgRepo.FindByNameReturns(org, nil)
err := orgReq.Execute()
Expect(err).NotTo(HaveOccurred())
Expect(orgRepo.FindByNameArgsForCall(0)).To(Equal("my-org-name"))
示例2:
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
testcmd "code.cloudfoundry.org/cli/testhelpers/commands"
testconfig "code.cloudfoundry.org/cli/testhelpers/configuration"
testterm "code.cloudfoundry.org/cli/testhelpers/terminal"
"code.cloudfoundry.org/cli/cf/commands"
. "code.cloudfoundry.org/cli/testhelpers/matchers"
)
var _ = Describe("target command", func() {
var (
orgRepo *organizationsfakes.FakeOrganizationRepository
spaceRepo *spacesfakes.FakeSpaceRepository
requirementsFactory *requirementsfakes.FakeFactory
config coreconfig.Repository
ui *testterm.FakeUI
deps commandregistry.Dependency
)
updateCommandDependency := func(pluginCall bool) {
deps.UI = ui
deps.Config = config
deps.RepoLocator = deps.RepoLocator.SetOrganizationRepository(orgRepo)
deps.RepoLocator = deps.RepoLocator.SetSpaceRepository(spaceRepo)
commandregistry.Commands.SetCommand(commandregistry.Commands.FindCommand("target").SetDependency(deps, pluginCall))
}
listSpacesStub := func(spaces []models.Space) func(func(models.Space) bool) error {
return func(cb func(models.Space) bool) error {
var keepGoing bool
示例3:
"code.cloudfoundry.org/cli/cf/errors"
. "code.cloudfoundry.org/cli/testhelpers/matchers"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("CopySource", func() {
var (
ui *testterm.FakeUI
config coreconfig.Repository
requirementsFactory *requirementsfakes.FakeFactory
authRepo *authenticationfakes.FakeRepository
appRepo *applicationsfakes.FakeRepository
copyAppSourceRepo *copyapplicationsourcefakes.FakeRepository
spaceRepo *spacesfakes.FakeSpaceRepository
orgRepo *organizationsfakes.FakeOrganizationRepository
appRestarter *applicationfakes.FakeRestarter
OriginalCommand commandregistry.Command
deps commandregistry.Dependency
)
updateCommandDependency := func(pluginCall bool) {
deps.UI = ui
deps.RepoLocator = deps.RepoLocator.SetAuthenticationRepository(authRepo)
deps.RepoLocator = deps.RepoLocator.SetApplicationRepository(appRepo)
deps.RepoLocator = deps.RepoLocator.SetCopyApplicationSourceRepository(copyAppSourceRepo)
deps.RepoLocator = deps.RepoLocator.SetSpaceRepository(spaceRepo)
deps.RepoLocator = deps.RepoLocator.SetOrganizationRepository(orgRepo)
deps.Config = config
示例4:
"code.cloudfoundry.org/cli/cf/api/securitygroups/spaces/spacesfakes"
spacesapifakes "code.cloudfoundry.org/cli/cf/api/spaces/spacesfakes"
testcmd "code.cloudfoundry.org/cli/testhelpers/commands"
testconfig "code.cloudfoundry.org/cli/testhelpers/configuration"
. "code.cloudfoundry.org/cli/testhelpers/matchers"
testterm "code.cloudfoundry.org/cli/testhelpers/terminal"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("unbind-security-group command", func() {
var (
ui *testterm.FakeUI
securityGroupRepo *securitygroupsfakes.FakeSecurityGroupRepo
orgRepo *organizationsfakes.FakeOrganizationRepository
spaceRepo *spacesapifakes.FakeSpaceRepository
secBinder *spacesfakes.FakeSecurityGroupSpaceBinder
requirementsFactory *requirementsfakes.FakeFactory
configRepo coreconfig.Repository
deps commandregistry.Dependency
)
updateCommandDependency := func(pluginCall bool) {
deps.UI = ui
deps.RepoLocator = deps.RepoLocator.SetSpaceRepository(spaceRepo)
deps.RepoLocator = deps.RepoLocator.SetOrganizationRepository(orgRepo)
deps.RepoLocator = deps.RepoLocator.SetSecurityGroupRepository(securityGroupRepo)
deps.RepoLocator = deps.RepoLocator.SetSecurityGroupSpaceBinder(secBinder)
deps.Config = configRepo
commandregistry.Commands.SetCommand(commandregistry.Commands.FindCommand("unbind-security-group").SetDependency(deps, pluginCall))
}
示例5:
testconfig "code.cloudfoundry.org/cli/testhelpers/configuration"
testterm "code.cloudfoundry.org/cli/testhelpers/terminal"
. "code.cloudfoundry.org/cli/testhelpers/matchers"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("create-space command", func() {
var (
ui *testterm.FakeUI
requirementsFactory *requirementsfakes.FakeFactory
configOrg models.OrganizationFields
configRepo coreconfig.Repository
spaceRepo *spacesfakes.FakeSpaceRepository
orgRepo *organizationsfakes.FakeOrganizationRepository
userRepo *apifakes.FakeUserRepository
spaceRoleSetter user.SpaceRoleSetter
flagRepo *featureflagsfakes.FakeFeatureFlagRepository
spaceQuotaRepo *spacequotasfakes.FakeSpaceQuotaRepository
OriginalCommand commandregistry.Command
deps commandregistry.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)
deps.Config = configRepo
示例6:
"code.cloudfoundry.org/cli/cf/configuration/coreconfig"
"code.cloudfoundry.org/cli/cf/models"
testcmd "code.cloudfoundry.org/cli/testhelpers/commands"
testconfig "code.cloudfoundry.org/cli/testhelpers/configuration"
testterm "code.cloudfoundry.org/cli/testhelpers/terminal"
. "code.cloudfoundry.org/cli/testhelpers/matchers"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("delete-org command", func() {
var (
config coreconfig.Repository
ui *testterm.FakeUI
requirementsFactory *requirementsfakes.FakeFactory
orgRepo *organizationsfakes.FakeOrganizationRepository
org models.Organization
deps commandregistry.Dependency
)
updateCommandDependency := func(pluginCall bool) {
deps.UI = ui
deps.RepoLocator = deps.RepoLocator.SetOrganizationRepository(orgRepo)
deps.Config = config
commandregistry.Commands.SetCommand(commandregistry.Commands.FindCommand("delete-org").SetDependency(deps, pluginCall))
}
BeforeEach(func() {
ui = &testterm.FakeUI{
Inputs: []string{"y"},
}
示例7:
testcmd "code.cloudfoundry.org/cli/testhelpers/commands"
testconfig "code.cloudfoundry.org/cli/testhelpers/configuration"
testterm "code.cloudfoundry.org/cli/testhelpers/terminal"
"code.cloudfoundry.org/cli/cf/commandregistry"
. "code.cloudfoundry.org/cli/testhelpers/matchers"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("bind-security-group command", func() {
var (
ui *testterm.FakeUI
configRepo coreconfig.Repository
fakeSecurityGroupRepo *securitygroupsfakes.FakeSecurityGroupRepo
requirementsFactory *requirementsfakes.FakeFactory
fakeSpaceRepo *spacesapifakes.FakeSpaceRepository
fakeOrgRepo *organizationsfakes.FakeOrganizationRepository
fakeSpaceBinder *spacesfakes.FakeSecurityGroupSpaceBinder
deps commandregistry.Dependency
)
updateCommandDependency := func(pluginCall bool) {
deps.UI = ui
deps.RepoLocator = deps.RepoLocator.SetSpaceRepository(fakeSpaceRepo)
deps.RepoLocator = deps.RepoLocator.SetOrganizationRepository(fakeOrgRepo)
deps.RepoLocator = deps.RepoLocator.SetSecurityGroupRepository(fakeSecurityGroupRepo)
deps.RepoLocator = deps.RepoLocator.SetSecurityGroupSpaceBinder(fakeSpaceBinder)
deps.Config = configRepo
commandregistry.Commands.SetCommand(commandregistry.Commands.FindCommand("bind-security-group").SetDependency(deps, pluginCall))
}
示例8:
testconfig "code.cloudfoundry.org/cli/testhelpers/configuration"
testterm "code.cloudfoundry.org/cli/testhelpers/terminal"
"code.cloudfoundry.org/cli/cf/commandregistry"
. "code.cloudfoundry.org/cli/testhelpers/matchers"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("create-org command", func() {
var (
config coreconfig.Repository
ui *testterm.FakeUI
requirementsFactory *requirementsfakes.FakeFactory
orgRepo *organizationsfakes.FakeOrganizationRepository
quotaRepo *quotasfakes.FakeQuotaRepository
deps commandregistry.Dependency
orgRoleSetter *userfakes.FakeOrgRoleSetter
flagRepo *featureflagsfakes.FakeFeatureFlagRepository
OriginalCommand commandregistry.Command
)
updateCommandDependency := func(pluginCall bool) {
deps.UI = ui
deps.RepoLocator = deps.RepoLocator.SetOrganizationRepository(orgRepo)
deps.RepoLocator = deps.RepoLocator.SetQuotaRepository(quotaRepo)
deps.RepoLocator = deps.RepoLocator.SetFeatureFlagRepository(flagRepo)
deps.Config = config
//inject fake 'command dependency' into registry
commandregistry.Register(orgRoleSetter)
示例9:
"code.cloudfoundry.org/cli/plugin/models"
testcmd "code.cloudfoundry.org/cli/testhelpers/commands"
testconfig "code.cloudfoundry.org/cli/testhelpers/configuration"
testterm "code.cloudfoundry.org/cli/testhelpers/terminal"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"code.cloudfoundry.org/cli/cf/commands/organization"
. "code.cloudfoundry.org/cli/testhelpers/matchers"
)
var _ = Describe("orgs command", func() {
var (
ui *testterm.FakeUI
orgRepo *organizationsfakes.FakeOrganizationRepository
configRepo coreconfig.Repository
requirementsFactory *requirementsfakes.FakeFactory
deps commandregistry.Dependency
)
updateCommandDependency := func(pluginCall bool) {
deps.UI = ui
deps.Config = configRepo
deps.RepoLocator = deps.RepoLocator.SetOrganizationRepository(orgRepo)
commandregistry.Commands.SetCommand(commandregistry.Commands.FindCommand("orgs").SetDependency(deps, pluginCall))
}
runCommand := func(args ...string) bool {
return testcmd.RunCLICommand("orgs", args, requirementsFactory, updateCommandDependency, false, ui)
}
示例10:
"code.cloudfoundry.org/cli/cf/actors"
"code.cloudfoundry.org/cli/cf/actors/brokerbuilder/brokerbuilderfakes"
"code.cloudfoundry.org/cli/cf/actors/servicebuilder/servicebuilderfakes"
"code.cloudfoundry.org/cli/cf/api/organizations/organizationsfakes"
"code.cloudfoundry.org/cli/cf/errors"
"code.cloudfoundry.org/cli/cf/models"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("Services", func() {
var (
actor actors.ServiceActor
brokerBuilder *brokerbuilderfakes.FakeBrokerBuilder
serviceBuilder *servicebuilderfakes.FakeServiceBuilder
orgRepo *organizationsfakes.FakeOrganizationRepository
serviceBroker1 models.ServiceBroker
service1 models.ServiceOffering
)
BeforeEach(func() {
orgRepo = new(organizationsfakes.FakeOrganizationRepository)
brokerBuilder = new(brokerbuilderfakes.FakeBrokerBuilder)
serviceBuilder = new(servicebuilderfakes.FakeServiceBuilder)
actor = actors.NewServiceHandler(orgRepo, brokerBuilder, serviceBuilder)
serviceBroker1 = models.ServiceBroker{GUID: "my-service-broker-guid1", Name: "my-service-broker1"}
service1 = models.ServiceOffering{ServiceOfferingFields: models.ServiceOfferingFields{
Label: "my-service1",
示例11:
"code.cloudfoundry.org/cli/cf/requirements"
"code.cloudfoundry.org/cli/cf/requirements/requirementsfakes"
testcmd "code.cloudfoundry.org/cli/testhelpers/commands"
testconfig "code.cloudfoundry.org/cli/testhelpers/configuration"
testterm "code.cloudfoundry.org/cli/testhelpers/terminal"
. "code.cloudfoundry.org/cli/testhelpers/matchers"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("delete-space-quota command", func() {
var (
ui *testterm.FakeUI
quotaRepo *spacequotasfakes.FakeSpaceQuotaRepository
orgRepo *organizationsfakes.FakeOrganizationRepository
requirementsFactory *requirementsfakes.FakeFactory
configRepo coreconfig.Repository
deps commandregistry.Dependency
)
updateCommandDependency := func(pluginCall bool) {
deps.UI = ui
deps.Config = configRepo
deps.RepoLocator = deps.RepoLocator.SetSpaceQuotaRepository(quotaRepo)
deps.RepoLocator = deps.RepoLocator.SetOrganizationRepository(orgRepo)
commandregistry.Commands.SetCommand(commandregistry.Commands.FindCommand("delete-space-quota").SetDependency(deps, pluginCall))
}
BeforeEach(func() {
ui = &testterm.FakeUI{}
quotaRepo = new(spacequotasfakes.FakeSpaceQuotaRepository)
示例12:
testterm "code.cloudfoundry.org/cli/testhelpers/terminal"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
. "code.cloudfoundry.org/cli/testhelpers/matchers"
)
var _ = Describe("Login Command", func() {
var (
Flags []string
Config coreconfig.Repository
ui *testterm.FakeUI
authRepo *authenticationfakes.FakeRepository
endpointRepo *coreconfigfakes.FakeEndpointRepository
orgRepo *organizationsfakes.FakeOrganizationRepository
spaceRepo *spacesfakes.FakeSpaceRepository
org models.Organization
deps commandregistry.Dependency
minCLIVersion string
minRecommendedCLIVersion string
)
updateCommandDependency := func(pluginCall bool) {
deps.UI = ui
deps.Config = Config
deps.RepoLocator = deps.RepoLocator.SetEndpointRepository(endpointRepo)
deps.RepoLocator = deps.RepoLocator.SetAuthenticationRepository(authRepo)
deps.RepoLocator = deps.RepoLocator.SetOrganizationRepository(orgRepo)
deps.RepoLocator = deps.RepoLocator.SetSpaceRepository(spaceRepo)
示例13:
"code.cloudfoundry.org/cli/cf/requirements"
"code.cloudfoundry.org/cli/cf/requirements/requirementsfakes"
testcmd "code.cloudfoundry.org/cli/testhelpers/commands"
testconfig "code.cloudfoundry.org/cli/testhelpers/configuration"
testterm "code.cloudfoundry.org/cli/testhelpers/terminal"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
. "code.cloudfoundry.org/cli/testhelpers/matchers"
)
var _ = Describe("rename-org command", func() {
var (
requirementsFactory *requirementsfakes.FakeFactory
orgRepo *organizationsfakes.FakeOrganizationRepository
ui *testterm.FakeUI
configRepo coreconfig.Repository
deps commandregistry.Dependency
)
updateCommandDependency := func(pluginCall bool) {
deps.UI = ui
deps.RepoLocator = deps.RepoLocator.SetOrganizationRepository(orgRepo)
deps.Config = configRepo
commandregistry.Commands.SetCommand(commandregistry.Commands.FindCommand("rename-org").SetDependency(deps, pluginCall))
}
BeforeEach(func() {
requirementsFactory = new(requirementsfakes.FakeFactory)
orgRepo = new(organizationsfakes.FakeOrganizationRepository)
ui = new(testterm.FakeUI)
示例14:
var _ = Describe("Service Plans", func() {
var (
actor actors.ServicePlanActor
servicePlanRepo *apifakes.OldFakeServicePlanRepo
servicePlanVisibilityRepo *apifakes.FakeServicePlanVisibilityRepository
orgRepo *organizationsfakes.FakeOrganizationRepository
planBuilder *planbuilderfakes.FakePlanBuilder
serviceBuilder *servicebuilderfakes.FakeServiceBuilder
privateServicePlanVisibilityFields models.ServicePlanVisibilityFields
publicServicePlanVisibilityFields models.ServicePlanVisibilityFields
limitedServicePlanVisibilityFields models.ServicePlanVisibilityFields
publicServicePlan models.ServicePlanFields
privateServicePlan models.ServicePlanFields
limitedServicePlan models.ServicePlanFields
publicService models.ServiceOffering
mixedService models.ServiceOffering
privateService models.ServiceOffering
publicAndLimitedService models.ServiceOffering
org1 models.Organization
org2 models.Organization
visibility1 models.ServicePlanVisibilityFields
)
BeforeEach(func() {