本文整理匯總了Golang中github.com/cloudfoundry/cli/cf/api/organizations/fakes.FakeOrganizationRepository類的典型用法代碼示例。如果您正苦於以下問題:Golang FakeOrganizationRepository類的具體用法?Golang FakeOrganizationRepository怎麽用?Golang FakeOrganizationRepository使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了FakeOrganizationRepository類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1:
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
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/cloudfoundry/cli/testhelpers/matchers"
)
var _ = Describe("target command", func() {
var (
orgRepo *fake_org.FakeOrganizationRepository
spaceRepo *testapi.FakeSpaceRepository
requirementsFactory *testreq.FakeReqFactory
config core_config.Repository
ui *testterm.FakeUI
deps command_registry.Dependency
)
updateCommandDependency := func(pluginCall bool) {
deps.Ui = ui
deps.Config = config
deps.RepoLocator = deps.RepoLocator.SetOrganizationRepository(orgRepo)
deps.RepoLocator = deps.RepoLocator.SetSpaceRepository(spaceRepo)
command_registry.Commands.SetCommand(command_registry.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
示例2:
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/cloudfoundry/cli/cf/commands/organization"
. "github.com/cloudfoundry/cli/testhelpers/matchers"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("delete-org command", func() {
var (
config core_config.ReadWriter
ui *testterm.FakeUI
requirementsFactory *testreq.FakeReqFactory
orgRepo *test_org.FakeOrganizationRepository
org models.Organization
)
BeforeEach(func() {
ui = &testterm.FakeUI{
Inputs: []string{"y"},
}
config = testconfig.NewRepositoryWithDefaults()
requirementsFactory = &testreq.FakeReqFactory{}
org = models.Organization{}
org.Name = "org-to-delete"
org.Guid = "org-to-delete-guid"
orgRepo = &test_org.FakeOrganizationRepository{}
示例3:
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("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
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.SetUserRepository(userRepo)
deps.Config = configRepo
示例4:
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
test_org "github.com/cloudfoundry/cli/cf/api/organizations/fakes"
"github.com/cloudfoundry/cli/cf/api/space_quotas/fakes"
"github.com/cloudfoundry/cli/cf/errors"
testcmd "github.com/cloudfoundry/cli/testhelpers/commands"
"github.com/cloudfoundry/cli/testhelpers/configuration"
testreq "github.com/cloudfoundry/cli/testhelpers/requirements"
testterm "github.com/cloudfoundry/cli/testhelpers/terminal"
)
var _ = Describe("create-quota command", func() {
var (
ui *testterm.FakeUI
quotaRepo *fakes.FakeSpaceQuotaRepository
orgRepo *test_org.FakeOrganizationRepository
requirementsFactory *testreq.FakeReqFactory
)
BeforeEach(func() {
ui = &testterm.FakeUI{}
quotaRepo = &fakes.FakeSpaceQuotaRepository{}
orgRepo = &test_org.FakeOrganizationRepository{}
requirementsFactory = &testreq.FakeReqFactory{}
org := models.Organization{}
org.Name = "my-org"
org.Guid = "my-org-guid"
orgRepo.ListOrgsReturns([]models.Organization{org}, nil)
orgRepo.FindByNameReturns(org, nil)
})
示例5:
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/cf/commands/securitygroup"
. "github.com/cloudfoundry/cli/testhelpers/matchers"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("bind-security-group command", func() {
var (
ui *testterm.FakeUI
cmd BindSecurityGroup
configRepo core_config.ReadWriter
fakeSecurityGroupRepo *testapi.FakeSecurityGroupRepo
requirementsFactory *testreq.FakeReqFactory
fakeSpaceRepo *fakes.FakeSpaceRepository
fakeOrgRepo *test_org.FakeOrganizationRepository
fakeSpaceBinder *zoidberg.FakeSecurityGroupSpaceBinder
)
BeforeEach(func() {
ui = &testterm.FakeUI{}
fakeOrgRepo = &test_org.FakeOrganizationRepository{}
fakeSpaceRepo = &fakes.FakeSpaceRepository{}
requirementsFactory = &testreq.FakeReqFactory{}
fakeSecurityGroupRepo = &testapi.FakeSecurityGroupRepo{}
configRepo = testconfig.NewRepositoryWithDefaults()
fakeSpaceBinder = &zoidberg.FakeSecurityGroupSpaceBinder{}
cmd = NewBindSecurityGroup(ui, configRepo, fakeSecurityGroupRepo, fakeSpaceRepo, fakeOrgRepo, fakeSpaceBinder)
})
示例6:
var _ = Describe("Service Plans", func() {
var (
actor actors.ServicePlanActor
servicePlanRepo *testapi.FakeServicePlanRepo
servicePlanVisibilityRepo *testapi.FakeServicePlanVisibilityRepository
orgRepo *fake_orgs.FakeOrganizationRepository
planBuilder *fake_plan_builder.FakePlanBuilder
serviceBuilder *fake_service_builder.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() {
示例7:
"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("rename-org command", func() {
var (
requirementsFactory *testreq.FakeReqFactory
orgRepo *test_org.FakeOrganizationRepository
ui *testterm.FakeUI
configRepo core_config.Repository
deps command_registry.Dependency
)
updateCommandDependency := func(pluginCall bool) {
deps.Ui = ui
deps.RepoLocator = deps.RepoLocator.SetOrganizationRepository(orgRepo)
deps.Config = configRepo
command_registry.Commands.SetCommand(command_registry.Commands.FindCommand("rename-org").SetDependency(deps, pluginCall))
}
BeforeEach(func() {
requirementsFactory = &testreq.FakeReqFactory{}
orgRepo = &test_org.FakeOrganizationRepository{}
ui = new(testterm.FakeUI)
示例8:
testreq "github.com/cloudfoundry/cli/testhelpers/requirements"
testterm "github.com/cloudfoundry/cli/testhelpers/terminal"
"github.com/cloudfoundry/cli/cf/command_registry"
. "github.com/cloudfoundry/cli/testhelpers/matchers"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("create-org command", func() {
var (
config core_config.Repository
ui *testterm.FakeUI
requirementsFactory *testreq.FakeReqFactory
orgRepo *test_org.FakeOrganizationRepository
quotaRepo *test_quota.FakeQuotaRepository
deps command_registry.Dependency
orgRoleSetter *userCmdFakes.FakeOrgRoleSetter
flagRepo *fakeflag.FakeFeatureFlagRepository
OriginalCommand command_registry.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
command_registry.Register(orgRoleSetter)
示例9:
"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/cloudfoundry/cli/cf/commands/organization"
. "github.com/cloudfoundry/cli/testhelpers/matchers"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("create-org command", func() {
var (
config configuration.ReadWriter
ui *testterm.FakeUI
requirementsFactory *testreq.FakeReqFactory
orgRepo *test_org.FakeOrganizationRepository
)
BeforeEach(func() {
ui = &testterm.FakeUI{}
config = testconfig.NewRepositoryWithDefaults()
requirementsFactory = &testreq.FakeReqFactory{}
orgRepo = &test_org.FakeOrganizationRepository{}
})
runCommand := func(args ...string) {
testcmd.RunCommand(NewCreateOrg(ui, config, orgRepo), args, requirementsFactory)
}
Describe("requirements", func() {
示例10:
"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 command", func() {
var (
ui *testterm.FakeUI
orgRepo *test_org.FakeOrganizationRepository
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.SetOrganizationRepository(orgRepo)
command_registry.Commands.SetCommand(command_registry.Commands.FindCommand("orgs").SetDependency(deps, pluginCall))
}
runCommand := func(args ...string) bool {
return testcmd.RunCliCommand("orgs", args, requirementsFactory, updateCommandDependency, false)
}
示例11:
testcmd "github.com/cloudfoundry/cli/testhelpers/commands"
testconfig "github.com/cloudfoundry/cli/testhelpers/configuration"
testterm "github.com/cloudfoundry/cli/testhelpers/terminal"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
. "github.com/cloudfoundry/cli/testhelpers/matchers"
)
var _ = Describe("Login Command", func() {
var (
Flags []string
Config core_config.Repository
ui *testterm.FakeUI
authRepo *testapi.FakeAuthenticationRepository
endpointRepo *testapi.FakeEndpointRepo
orgRepo *fake_organizations.FakeOrganizationRepository
spaceRepo *testapi.FakeSpaceRepository
org models.Organization
deps command_registry.Dependency
)
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)
command_registry.Commands.SetCommand(command_registry.Commands.FindCommand("login").SetDependency(deps, pluginCall))
}
示例12:
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/cloudfoundry/cli/cf/commands/organization"
. "github.com/cloudfoundry/cli/testhelpers/matchers"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("create-org command", func() {
var (
config configuration.ReadWriter
ui *testterm.FakeUI
requirementsFactory *testreq.FakeReqFactory
orgRepo *test_org.FakeOrganizationRepository
quotaRepo *test_quota.FakeQuotaRepository
)
BeforeEach(func() {
ui = &testterm.FakeUI{}
config = testconfig.NewRepositoryWithDefaults()
requirementsFactory = &testreq.FakeReqFactory{}
orgRepo = &test_org.FakeOrganizationRepository{}
quotaRepo = &test_quota.FakeQuotaRepository{}
})
runCommand := func(args ...string) {
testcmd.RunCommand(NewCreateOrg(ui, config, orgRepo, quotaRepo), args, requirementsFactory)
}
示例13:
"github.com/cloudfoundry/cli/cf/actors"
broker_builder "github.com/cloudfoundry/cli/cf/actors/broker_builder/fakes"
service_builder "github.com/cloudfoundry/cli/cf/actors/service_builder/fakes"
organization_fakes "github.com/cloudfoundry/cli/cf/api/organizations/fakes"
"github.com/cloudfoundry/cli/cf/errors"
"github.com/cloudfoundry/cli/cf/models"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("Services", func() {
var (
actor actors.ServiceActor
brokerBuilder *broker_builder.FakeBrokerBuilder
serviceBuilder *service_builder.FakeServiceBuilder
orgRepo *organization_fakes.FakeOrganizationRepository
serviceBroker1 models.ServiceBroker
service1 models.ServiceOffering
)
BeforeEach(func() {
orgRepo = &organization_fakes.FakeOrganizationRepository{}
brokerBuilder = &broker_builder.FakeBrokerBuilder{}
serviceBuilder = &service_builder.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",
示例14:
fakeBinder "github.com/cloudfoundry/cli/cf/api/security_groups/spaces/fakes"
testcmd "github.com/cloudfoundry/cli/testhelpers/commands"
testconfig "github.com/cloudfoundry/cli/testhelpers/configuration"
. "github.com/cloudfoundry/cli/testhelpers/matchers"
testreq "github.com/cloudfoundry/cli/testhelpers/requirements"
testterm "github.com/cloudfoundry/cli/testhelpers/terminal"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("unbind-security-group command", func() {
var (
ui *testterm.FakeUI
securityGroupRepo *fakeSecurityGroup.FakeSecurityGroupRepo
orgRepo *fake_org.FakeOrganizationRepository
spaceRepo *fakes.FakeSpaceRepository
secBinder *fakeBinder.FakeSecurityGroupSpaceBinder
requirementsFactory *testreq.FakeReqFactory
configRepo core_config.Repository
deps command_registry.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
command_registry.Commands.SetCommand(command_registry.Commands.FindCommand("unbind-security-group").SetDependency(deps, pluginCall))
}
示例15:
"github.com/cloudfoundry/cli/cf/configuration/core_config"
"github.com/cloudfoundry/cli/cf/errors"
. "github.com/cloudfoundry/cli/testhelpers/matchers"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("CopySource", func() {
var (
ui *testterm.FakeUI
config core_config.ReadWriter
requirementsFactory *testreq.FakeReqFactory
authRepo *testapi.FakeAuthenticationRepository
appRepo *testApplication.FakeApplicationRepository
copyAppSourceRepo *testCopyApplication.FakeCopyApplicationSourceRepository
spaceRepo *testapi.FakeSpaceRepository
orgRepo *testorg.FakeOrganizationRepository
appRestarter *testcmd.FakeApplicationRestarter
)
BeforeEach(func() {
ui = &testterm.FakeUI{}
requirementsFactory = &testreq.FakeReqFactory{LoginSuccess: true, TargetedSpaceSuccess: true}
authRepo = &testapi.FakeAuthenticationRepository{}
appRepo = &testApplication.FakeApplicationRepository{}
copyAppSourceRepo = &testCopyApplication.FakeCopyApplicationSourceRepository{}
spaceRepo = &testapi.FakeSpaceRepository{}
orgRepo = &testorg.FakeOrganizationRepository{}
appRestarter = &testcmd.FakeApplicationRestarter{}