本文整理匯總了Golang中github.com/nttlabs/cli/testhelpers/requirements.FakeReqFactory類的典型用法代碼示例。如果您正苦於以下問題:Golang FakeReqFactory類的具體用法?Golang FakeReqFactory怎麽用?Golang FakeReqFactory使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了FakeReqFactory類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1:
testcmd "github.com/nttlabs/cli/testhelpers/commands"
testconfig "github.com/nttlabs/cli/testhelpers/configuration"
testreq "github.com/nttlabs/cli/testhelpers/requirements"
testterm "github.com/nttlabs/cli/testhelpers/terminal"
. "github.com/nttlabs/cli/cf/commands/application"
"github.com/nttlabs/cli/cf/configuration/core_config"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("restart command", func() {
var (
ui *testterm.FakeUI
requirementsFactory *testreq.FakeReqFactory
starter *testcmd.FakeApplicationStarter
stopper *testcmd.FakeApplicationStopper
config core_config.ReadWriter
app models.Application
)
BeforeEach(func() {
ui = &testterm.FakeUI{}
requirementsFactory = &testreq.FakeReqFactory{}
starter = &testcmd.FakeApplicationStarter{}
stopper = &testcmd.FakeApplicationStopper{}
config = testconfig.NewRepositoryWithDefaults()
app = models.Application{}
app.Name = "my-app"
app.Guid = "my-app-guid"
})
示例2:
"github.com/nttlabs/cli/cf/models"
testcmd "github.com/nttlabs/cli/testhelpers/commands"
testconfig "github.com/nttlabs/cli/testhelpers/configuration"
testreq "github.com/nttlabs/cli/testhelpers/requirements"
testterm "github.com/nttlabs/cli/testhelpers/terminal"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
. "github.com/nttlabs/cli/testhelpers/matchers"
)
var _ = Describe("space-users command", func() {
var (
ui *testterm.FakeUI
requirementsFactory *testreq.FakeReqFactory
spaceRepo *testapi.FakeSpaceRepository
userRepo *testapi.FakeUserRepository
config core_config.ReadWriter
)
BeforeEach(func() {
config = testconfig.NewRepositoryWithDefaults()
ui = &testterm.FakeUI{}
requirementsFactory = &testreq.FakeReqFactory{}
spaceRepo = &testapi.FakeSpaceRepository{}
userRepo = &testapi.FakeUserRepository{}
})
runCommand := func(args ...string) {
testcmd.RunCommand(NewSpaceUsers(ui, config, spaceRepo, userRepo), args, requirementsFactory)
}
示例3:
testconfig "github.com/nttlabs/cli/testhelpers/configuration"
testlogs "github.com/nttlabs/cli/testhelpers/logs"
testreq "github.com/nttlabs/cli/testhelpers/requirements"
testterm "github.com/nttlabs/cli/testhelpers/terminal"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
. "github.com/nttlabs/cli/testhelpers/matchers"
)
var _ = Describe("start command", func() {
var (
ui *testterm.FakeUI
defaultAppForStart = models.Application{}
defaultInstanceResponses = [][]models.AppInstanceFields{}
defaultInstanceErrorCodes = []string{"", ""}
requirementsFactory *testreq.FakeReqFactory
logsForTail []*logmessage.LogMessage
logRepo *testapi.FakeLogsRepository
)
getInstance := func(appGuid string) (instances []models.AppInstanceFields, apiErr error) {
if len(defaultInstanceResponses) > 0 {
instances = defaultInstanceResponses[0]
if len(defaultInstanceResponses) > 1 {
defaultInstanceResponses = defaultInstanceResponses[1:]
}
}
if len(defaultInstanceErrorCodes) > 0 {
errorCode := defaultInstanceErrorCodes[0]
if len(defaultInstanceErrorCodes) > 1 {
示例4:
"github.com/nttlabs/cli/cf/configuration/core_config"
"github.com/nttlabs/cli/cf/models"
testcmd "github.com/nttlabs/cli/testhelpers/commands"
testconfig "github.com/nttlabs/cli/testhelpers/configuration"
testreq "github.com/nttlabs/cli/testhelpers/requirements"
testterm "github.com/nttlabs/cli/testhelpers/terminal"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
. "github.com/nttlabs/cli/testhelpers/matchers"
)
var _ = Describe("list-apps command", func() {
var (
ui *testterm.FakeUI
configRepo core_config.ReadWriter
appSummaryRepo *testapi.FakeAppSummaryRepo
requirementsFactory *testreq.FakeReqFactory
)
BeforeEach(func() {
ui = &testterm.FakeUI{}
appSummaryRepo = &testapi.FakeAppSummaryRepo{}
configRepo = testconfig.NewRepositoryWithDefaults()
requirementsFactory = &testreq.FakeReqFactory{
LoginSuccess: true,
TargetedSpaceSuccess: true,
}
})
runCommand := func() {
cmd := NewListApps(ui, configRepo, appSummaryRepo)
示例5:
"github.com/nttlabs/cli/cf/models"
testcmd "github.com/nttlabs/cli/testhelpers/commands"
testconfig "github.com/nttlabs/cli/testhelpers/configuration"
testreq "github.com/nttlabs/cli/testhelpers/requirements"
testterm "github.com/nttlabs/cli/testhelpers/terminal"
. "github.com/nttlabs/cli/cf/commands/domain"
. "github.com/nttlabs/cli/testhelpers/matchers"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("domains command", func() {
var (
ui *testterm.FakeUI
configRepo core_config.ReadWriter
domainRepo *testapi.FakeDomainRepository
requirementsFactory *testreq.FakeReqFactory
)
BeforeEach(func() {
ui = &testterm.FakeUI{}
configRepo = testconfig.NewRepositoryWithDefaults()
domainRepo = &testapi.FakeDomainRepository{}
requirementsFactory = &testreq.FakeReqFactory{}
})
runCommand := func(args ...string) {
testcmd.RunCommand(NewListDomains(ui, configRepo, domainRepo), args, requirementsFactory)
}
Describe("requirements", func() {
示例6:
testapi "github.com/nttlabs/cli/cf/api/fakes"
. "github.com/nttlabs/cli/cf/commands/service"
"github.com/nttlabs/cli/cf/models"
testcmd "github.com/nttlabs/cli/testhelpers/commands"
testconfig "github.com/nttlabs/cli/testhelpers/configuration"
testreq "github.com/nttlabs/cli/testhelpers/requirements"
testterm "github.com/nttlabs/cli/testhelpers/terminal"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
. "github.com/nttlabs/cli/testhelpers/matchers"
)
var _ = Describe("bind-service command", func() {
var (
requirementsFactory *testreq.FakeReqFactory
)
BeforeEach(func() {
requirementsFactory = &testreq.FakeReqFactory{}
})
It("fails requirements when not logged in", func() {
cmd := NewBindService(&testterm.FakeUI{}, testconfig.NewRepository(), &testapi.FakeServiceBindingRepo{})
testcmd.RunCommand(cmd, []string{"service", "app"}, requirementsFactory)
Expect(testcmd.CommandDidPassRequirements).To(BeFalse())
})
Context("when logged in", func() {
BeforeEach(func() {
示例7:
"github.com/nttlabs/cli/cf/models"
testcmd "github.com/nttlabs/cli/testhelpers/commands"
testconfig "github.com/nttlabs/cli/testhelpers/configuration"
testreq "github.com/nttlabs/cli/testhelpers/requirements"
testterm "github.com/nttlabs/cli/testhelpers/terminal"
. "github.com/nttlabs/cli/cf/commands/service"
. "github.com/nttlabs/cli/testhelpers/matchers"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("update-user-provided-service test", func() {
var (
ui *testterm.FakeUI
configRepo core_config.ReadWriter
serviceRepo *testapi.FakeUserProvidedServiceInstanceRepo
requirementsFactory *testreq.FakeReqFactory
)
BeforeEach(func() {
ui = &testterm.FakeUI{}
serviceRepo = &testapi.FakeUserProvidedServiceInstanceRepo{}
configRepo = testconfig.NewRepositoryWithDefaults()
requirementsFactory = &testreq.FakeReqFactory{}
})
runCommand := func(args ...string) {
cmd := NewUpdateUserProvidedService(ui, configRepo, serviceRepo)
testcmd.RunCommand(cmd, args, requirementsFactory)
}
示例8:
"github.com/nttlabs/cli/cf/errors"
"github.com/nttlabs/cli/cf/models"
testcmd "github.com/nttlabs/cli/testhelpers/commands"
"github.com/nttlabs/cli/testhelpers/configuration"
. "github.com/nttlabs/cli/testhelpers/matchers"
testreq "github.com/nttlabs/cli/testhelpers/requirements"
testterm "github.com/nttlabs/cli/testhelpers/terminal"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("update-space-quota command", func() {
var (
ui *testterm.FakeUI
quotaRepo *fakes.FakeSpaceQuotaRepository
requirementsFactory *testreq.FakeReqFactory
quota models.SpaceQuota
quotaPaidService models.SpaceQuota
)
runCommand := func(args ...string) bool {
cmd := NewUpdateSpaceQuota(ui, configuration.NewRepositoryWithDefaults(), quotaRepo)
return testcmd.RunCommand(cmd, args, requirementsFactory)
}
BeforeEach(func() {
ui = &testterm.FakeUI{}
quotaRepo = &fakes.FakeSpaceQuotaRepository{}
requirementsFactory = &testreq.FakeReqFactory{}
})
示例9:
"github.com/nttlabs/cli/cf/models"
testcmd "github.com/nttlabs/cli/testhelpers/commands"
testconfig "github.com/nttlabs/cli/testhelpers/configuration"
testreq "github.com/nttlabs/cli/testhelpers/requirements"
testterm "github.com/nttlabs/cli/testhelpers/terminal"
. "github.com/nttlabs/cli/cf/commands/route"
. "github.com/nttlabs/cli/testhelpers/matchers"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("create-route command", func() {
var (
ui *testterm.FakeUI
routeRepo *testapi.FakeRouteRepository
requirementsFactory *testreq.FakeReqFactory
config core_config.ReadWriter
)
BeforeEach(func() {
ui = &testterm.FakeUI{}
routeRepo = &testapi.FakeRouteRepository{}
requirementsFactory = &testreq.FakeReqFactory{}
config = testconfig.NewRepositoryWithDefaults()
})
runCommand := func(args ...string) {
testcmd.RunCommand(NewCreateRoute(ui, config, routeRepo), args, requirementsFactory)
}
Describe("requirements", func() {
示例10:
"github.com/nttlabs/cli/cf/models"
testcmd "github.com/nttlabs/cli/testhelpers/commands"
testconfig "github.com/nttlabs/cli/testhelpers/configuration"
testreq "github.com/nttlabs/cli/testhelpers/requirements"
testterm "github.com/nttlabs/cli/testhelpers/terminal"
. "github.com/nttlabs/cli/cf/commands/service"
. "github.com/nttlabs/cli/testhelpers/matchers"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("rename-service command", func() {
var (
ui *testterm.FakeUI
config core_config.ReadWriter
serviceRepo *testapi.FakeServiceRepo
requirementsFactory *testreq.FakeReqFactory
)
BeforeEach(func() {
ui = &testterm.FakeUI{}
config = testconfig.NewRepositoryWithDefaults()
serviceRepo = &testapi.FakeServiceRepo{}
requirementsFactory = &testreq.FakeReqFactory{}
})
runCommand := func(args ...string) {
testcmd.RunCommand(NewRenameService(ui, config, serviceRepo), args, requirementsFactory)
}
Describe("requirements", func() {
示例11:
. "github.com/nttlabs/cli/cf/commands/service"
"github.com/nttlabs/cli/cf/configuration/core_config"
"github.com/nttlabs/cli/cf/models"
testcmd "github.com/nttlabs/cli/testhelpers/commands"
testconfig "github.com/nttlabs/cli/testhelpers/configuration"
testreq "github.com/nttlabs/cli/testhelpers/requirements"
testterm "github.com/nttlabs/cli/testhelpers/terminal"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
. "github.com/nttlabs/cli/testhelpers/matchers"
)
var _ = Describe("marketplace command", func() {
var ui *testterm.FakeUI
var requirementsFactory *testreq.FakeReqFactory
var config core_config.ReadWriter
var serviceRepo *testapi.FakeServiceRepo
var fakeServiceOfferings []models.ServiceOffering
BeforeEach(func() {
serviceRepo = &testapi.FakeServiceRepo{}
ui = &testterm.FakeUI{}
requirementsFactory = &testreq.FakeReqFactory{ApiEndpointSuccess: true}
fakeServiceOfferings = []models.ServiceOffering{
models.ServiceOffering{
Plans: []models.ServicePlanFields{
models.ServicePlanFields{Name: "service-plan-a"},
models.ServicePlanFields{Name: "service-plan-b"},
},
示例12:
testapi "github.com/nttlabs/cli/cf/api/fakes"
"github.com/nttlabs/cli/cf/models"
testcmd "github.com/nttlabs/cli/testhelpers/commands"
testconfig "github.com/nttlabs/cli/testhelpers/configuration"
testreq "github.com/nttlabs/cli/testhelpers/requirements"
testterm "github.com/nttlabs/cli/testhelpers/terminal"
. "github.com/nttlabs/cli/cf/commands/route"
. "github.com/nttlabs/cli/testhelpers/matchers"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("delete-orphaned-routes command", func() {
var routeRepo *testapi.FakeRouteRepository
var reqFactory *testreq.FakeReqFactory
BeforeEach(func() {
routeRepo = &testapi.FakeRouteRepository{}
reqFactory = &testreq.FakeReqFactory{}
})
It("fails requirements when not logged in", func() {
callDeleteOrphanedRoutes("y", []string{}, reqFactory, routeRepo)
Expect(testcmd.CommandDidPassRequirements).To(BeFalse())
})
Context("when logged in successfully", func() {
BeforeEach(func() {
reqFactory.LoginSuccess = true
示例13:
"github.com/nttlabs/cli/cf/models"
testcmd "github.com/nttlabs/cli/testhelpers/commands"
testconfig "github.com/nttlabs/cli/testhelpers/configuration"
testreq "github.com/nttlabs/cli/testhelpers/requirements"
testterm "github.com/nttlabs/cli/testhelpers/terminal"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
. "github.com/nttlabs/cli/testhelpers/matchers"
)
var _ = Describe("auth command", func() {
var (
ui *testterm.FakeUI
cmd Authenticate
config core_config.ReadWriter
repo *testapi.FakeAuthenticationRepository
requirementsFactory *testreq.FakeReqFactory
)
BeforeEach(func() {
ui = &testterm.FakeUI{}
config = testconfig.NewRepositoryWithDefaults()
requirementsFactory = &testreq.FakeReqFactory{}
repo = &testapi.FakeAuthenticationRepository{
Config: config,
AccessToken: "my-access-token",
RefreshToken: "my-refresh-token",
}
cmd = NewAuthenticate(ui, config, repo)
})
示例14:
testapi "github.com/nttlabs/cli/cf/api/fakes"
"github.com/nttlabs/cli/cf/commands/buildpack"
"github.com/nttlabs/cli/cf/models"
testcmd "github.com/nttlabs/cli/testhelpers/commands"
testreq "github.com/nttlabs/cli/testhelpers/requirements"
testterm "github.com/nttlabs/cli/testhelpers/terminal"
. "github.com/nttlabs/cli/testhelpers/matchers"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("ListBuildpacks", func() {
var (
ui *testterm.FakeUI
buildpackRepo *testapi.FakeBuildpackRepository
requirementsFactory *testreq.FakeReqFactory
)
BeforeEach(func() {
ui = &testterm.FakeUI{}
buildpackRepo = &testapi.FakeBuildpackRepository{}
requirementsFactory = &testreq.FakeReqFactory{}
})
RunCommand := func(args ...string) {
cmd := buildpack.NewListBuildpacks(ui, buildpackRepo)
testcmd.RunCommand(cmd, args, requirementsFactory)
}
It("fails requirements when login fails", func() {
示例15:
"github.com/nttlabs/cli/cf/configuration/core_config"
"github.com/nttlabs/cli/cf/models"
testcmd "github.com/nttlabs/cli/testhelpers/commands"
testconfig "github.com/nttlabs/cli/testhelpers/configuration"
testreq "github.com/nttlabs/cli/testhelpers/requirements"
testterm "github.com/nttlabs/cli/testhelpers/terminal"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
. "github.com/nttlabs/cli/testhelpers/matchers"
)
var _ = Describe("rename-space command", func() {
var (
ui *testterm.FakeUI
configRepo core_config.ReadWriter
requirementsFactory *testreq.FakeReqFactory
spaceRepo *testapi.FakeSpaceRepository
)
BeforeEach(func() {
ui = new(testterm.FakeUI)
configRepo = testconfig.NewRepositoryWithDefaults()
requirementsFactory = &testreq.FakeReqFactory{LoginSuccess: true, TargetedOrgSuccess: true}
spaceRepo = &testapi.FakeSpaceRepository{}
})
var callRenameSpace = func(args []string) {
cmd := NewRenameSpace(ui, configRepo, spaceRepo)
testcmd.RunCommand(cmd, args, requirementsFactory)
}