本文整理汇总了Golang中github.com/cloudfoundry/cli/testhelpers/configuration.NewRepository函数的典型用法代码示例。如果您正苦于以下问题:Golang NewRepository函数的具体用法?Golang NewRepository怎么用?Golang NewRepository使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了NewRepository函数的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: getPasswordDeps
func getPasswordDeps() passwordDeps {
return passwordDeps{
ReqFactory: new(requirementsfakes.FakeFactory),
PwdRepo: &apifakes.OldFakePasswordRepo{UpdateUnauthorized: true},
Config: testconfig.NewRepository(),
}
}
开发者ID:Reejoshi,项目名称:cli,代码行数:7,代码来源:passwd_test.go
示例2: getPasswordDeps
func getPasswordDeps() passwordDeps {
return passwordDeps{
ReqFactory: &testreq.FakeReqFactory{LoginSuccess: true},
PwdRepo: &testapi.FakePasswordRepo{UpdateUnauthorized: true},
Config: testconfig.NewRepository(),
}
}
开发者ID:hail100,项目名称:cli,代码行数:7,代码来源:passwd_test.go
示例3: newCurlDependencies
func newCurlDependencies() (deps curlDependencies) {
deps.ui = &testterm.FakeUI{}
deps.config = testconfig.NewRepository()
deps.requirementsFactory = &testreq.FakeReqFactory{}
deps.curlRepo = &testapi.FakeCurlRepository{}
return
}
开发者ID:jacopen,项目名称:cli,代码行数:7,代码来源:curl_test.go
示例4: findCommand
func findCommand(cmdName string) (cmd cli.Command) {
fakeUI := &testterm.FakeUI{}
configRepo := testconfig.NewRepository()
pluginConfig := &testPluginConfig.FakePluginConfiguration{}
manifestRepo := manifest.NewManifestDiskRepository()
apiRepoLocator := api.NewRepositoryLocator(configRepo, map[string]net.Gateway{
"auth": net.NewUAAGateway(configRepo, fakeUI),
"cloud-controller": net.NewCloudControllerGateway(configRepo, time.Now, fakeUI),
"uaa": net.NewUAAGateway(configRepo, fakeUI),
})
rpcService, _ := rpc.NewRpcService(nil, nil, nil, nil, api.RepositoryLocator{}, nil)
cmdFactory := command_factory.NewFactory(fakeUI, configRepo, manifestRepo, apiRepoLocator, pluginConfig, rpcService)
requirementsFactory := &testreq.FakeReqFactory{}
cmdRunner := command_runner.NewRunner(cmdFactory, requirementsFactory, fakeUI)
myApp := app.NewApp(cmdRunner, cmdFactory.CommandMetadatas()...)
for _, cmd := range myApp.Commands {
if cmd.Name == cmdName {
return cmd
}
}
panic(fmt.Sprintf("command %s does not exist", cmdName))
return
}
开发者ID:tools-alexuser01,项目名称:cli,代码行数:25,代码来源:context.go
示例5: setupDependencies
func setupDependencies() (obj commandDependencies) {
obj.ui = &testterm.FakeUI{}
obj.config = testconfig.NewRepository()
obj.requirementsFactory = &testreq.FakeReqFactory{LoginSuccess: true, TargetedSpaceSuccess: true}
obj.serviceRepo = new(testapi.FakeServiceRepo)
return
}
开发者ID:BlueSpice,项目名称:cli,代码行数:8,代码来源:purge_service_offering_test.go
示例6: createCommandFactory
func createCommandFactory() command_factory.Factory {
fakeUI := &testterm.FakeUI{}
configRepo := testconfig.NewRepository()
manifestRepo := manifest.NewManifestDiskRepository()
apiRepoLocator := api.NewRepositoryLocator(configRepo, map[string]net.Gateway{
"auth": net.NewUAAGateway(configRepo),
"cloud-controller": net.NewCloudControllerGateway(configRepo, time.Now),
"uaa": net.NewUAAGateway(configRepo),
})
return command_factory.NewFactory(fakeUI, configRepo, manifestRepo, apiRepoLocator)
}
开发者ID:GABONIA,项目名称:cli,代码行数:12,代码来源:help_test.go
示例7: createAuthenticationRepository
func createAuthenticationRepository(apiServer *httptest.Server, authServer *httptest.Server) (core_config.ReadWriter, authentication.AuthenticationRepository) {
config := testconfig.NewRepository()
config.SetAuthenticationEndpoint(authServer.URL)
config.SetApiEndpoint(apiServer.URL)
config.SetAccessToken("bearer initial-access-token")
config.SetRefreshToken("initial-refresh-token")
authGateway := NewUAAGateway(config, &testterm.FakeUI{})
authGateway.SetTrustedCerts(authServer.TLS.Certificates)
authenticator := authentication.NewUAAAuthenticationRepository(authGateway, config)
return config, authenticator
}
开发者ID:vframbach,项目名称:cli,代码行数:14,代码来源:gateway_test.go
示例8: createCommandFactory
func createCommandFactory() command_factory.Factory {
fakeUI := &testterm.FakeUI{}
configRepo := testconfig.NewRepository()
pluginConfig := &testPluginConfig.FakePluginConfiguration{}
manifestRepo := manifest.NewManifestDiskRepository()
apiRepoLocator := api.NewRepositoryLocator(configRepo, map[string]net.Gateway{
"auth": net.NewUAAGateway(configRepo, fakeUI),
"cloud-controller": net.NewCloudControllerGateway(configRepo, time.Now, fakeUI),
"uaa": net.NewUAAGateway(configRepo, fakeUI),
})
rpcService, _ := rpc.NewRpcService(nil, nil, nil, nil)
return command_factory.NewFactory(fakeUI, configRepo, manifestRepo, apiRepoLocator, pluginConfig, rpcService)
}
开发者ID:raghulsid,项目名称:cli,代码行数:15,代码来源:help_test.go
示例9: createAuthenticationRepository
func createAuthenticationRepository(apiServer *httptest.Server, authServer *httptest.Server) (coreconfig.ReadWriter, authentication.AuthenticationRepository) {
config := testconfig.NewRepository()
config.SetAuthenticationEndpoint(authServer.URL)
config.SetAPIEndpoint(apiServer.URL)
config.SetAccessToken("bearer initial-access-token")
config.SetRefreshToken("initial-refresh-token")
authGateway := NewUAAGateway(config, &testterm.FakeUI{}, new(tracefakes.FakePrinter))
authGateway.SetTrustedCerts(authServer.TLS.Certificates)
fakePrinter := new(tracefakes.FakePrinter)
dumper := NewRequestDumper(fakePrinter)
authenticator := authentication.NewUAAAuthenticationRepository(authGateway, config, dumper)
return config, authenticator
}
开发者ID:yingkitw,项目名称:cli,代码行数:16,代码来源:gateway_test.go
示例10:
app.Name = "my-app"
app.Guid = "my-app-guid"
serviceInstance.Name = "my-service"
serviceInstance.Guid = "my-service-guid"
requirementsFactory = &testreq.FakeReqFactory{}
requirementsFactory.Application = app
requirementsFactory.ServiceInstance = serviceInstance
serviceBindingRepo = &testapi.FakeServiceBindingRepo{}
})
Context("when not logged in", func() {
It("fails requirements when not logged in", func() {
cmd := NewUnbindService(&testterm.FakeUI{}, testconfig.NewRepository(), serviceBindingRepo)
Expect(testcmd.RunCommand(cmd, []string{"my-service", "my-app"}, requirementsFactory)).To(BeFalse())
})
})
Context("when logged in", func() {
BeforeEach(func() {
requirementsFactory.LoginSuccess = true
})
Context("when the service instance exists", func() {
It("unbinds a service from an app", func() {
ui := callUnbindService([]string{"my-app", "my-service"}, requirementsFactory, serviceBindingRepo)
Expect(requirementsFactory.ApplicationName).To(Equal("my-app"))
Expect(requirementsFactory.ServiceInstanceName).To(Equal("my-service"))
开发者ID:tools-alexuser01,项目名称:cli,代码行数:31,代码来源:unbind_service_test.go
示例11:
. "github.com/onsi/gomega"
. "github.com/cloudfoundry/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() {
requirementsFactory.LoginSuccess = true
})
It("binds a service instance to an app", func() {
app := models.Application{}
app.Name = "my-app"
app.Guid = "my-app-guid"
serviceInstance := models.ServiceInstance{}
开发者ID:GABONIA,项目名称:cli,代码行数:31,代码来源:bind_service_test.go
示例12: newCurlDependencies
func newCurlDependencies() (deps curlDependencies) {
deps.config = testconfig.NewRepository()
deps.config.SetAccessToken("BEARER my_access_token")
deps.gateway = net.NewCloudControllerGateway(deps.config, time.Now, new(terminalfakes.FakeUI), new(tracefakes.FakePrinter), "")
return
}
开发者ID:Reejoshi,项目名称:cli,代码行数:6,代码来源:curl_test.go
示例13:
apiErr = errors.NewHttpError(400, errorCode, "Error staging app")
}
}
return
}
AfterEach(func() {
command_registry.Register(OriginalAppCommand)
})
BeforeEach(func() {
deps = command_registry.NewDependency()
ui = new(testterm.FakeUI)
requirementsFactory = &testreq.FakeReqFactory{}
configRepo = testconfig.NewRepository()
appInstancesRepo = &testAppInstanaces.FakeAppInstancesRepository{}
appRepo = &testApplication.FakeApplicationRepository{}
displayApp = &appCmdFakes.FakeAppDisplayer{}
//save original command dependency and restore later
OriginalAppCommand = command_registry.Commands.FindCommand("app")
defaultInstanceErrorCodes = []string{"", ""}
defaultAppForStart = models.Application{}
defaultAppForStart.Name = "my-app"
defaultAppForStart.Guid = "my-app-guid"
defaultAppForStart.InstanceCount = 2
开发者ID:rbramwell,项目名称:cli,代码行数:31,代码来源:start_test.go
示例14:
"authorization_endpoint": "https://login.example.com",
"api_version": "42.0.0"
}`)
}
var _ = Describe("Endpoints Repository", func() {
var (
coreConfig coreconfig.ReadWriter
gateway net.Gateway
testServer *httptest.Server
repo RemoteInfoRepository
testServerFn func(w http.ResponseWriter, r *http.Request)
)
BeforeEach(func() {
coreConfig = testconfig.NewRepository()
testServer = httptest.NewTLSServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
testServerFn(w, r)
}))
gateway = cloudcontrollergateway.NewTestCloudControllerGateway(coreConfig)
gateway.SetTrustedCerts(testServer.TLS.Certificates)
repo = NewEndpointRepository(gateway)
})
AfterEach(func() {
testServer.Close()
})
Describe("updating the endpoints", func() {
Context("when the API request is successful", func() {
var (
开发者ID:yingkitw,项目名称:cli,代码行数:31,代码来源:endpoints_test.go
示例15:
. "github.com/cloudfoundry/cli/testhelpers/matchers"
)
var _ = Describe("stop command", func() {
var (
requirementsFactory *testreq.FakeReqFactory
)
BeforeEach(func() {
requirementsFactory = &testreq.FakeReqFactory{}
})
It("fails requirements when not logged in", func() {
requirementsFactory.LoginSuccess = false
appRepo := &testapi.FakeApplicationRepository{}
cmd := NewStop(new(testterm.FakeUI), testconfig.NewRepository(), appRepo)
testcmd.RunCommand(cmd, []string{"some-app-name"}, requirementsFactory)
Expect(testcmd.CommandDidPassRequirements).To(BeFalse())
})
Context("when logged in", func() {
BeforeEach(func() {
requirementsFactory.LoginSuccess = true
})
It("fails with usage when the app name is not given", func() {
app := models.Application{}
app.Name = "my-app"
app.Guid = "my-app-guid"
appRepo := &testapi.FakeApplicationRepository{}
开发者ID:GABONIA,项目名称:cli,代码行数:31,代码来源:stop_test.go
示例16:
. "github.com/onsi/gomega"
"github.com/onsi/gomega/ghttp"
)
var _ = Describe("AuthenticationRepository", func() {
Describe("legacy tests", func() {
var (
gateway net.Gateway
testServer *httptest.Server
handler *testnet.TestHandler
config core_config.ReadWriter
auth AuthenticationRepository
)
BeforeEach(func() {
config = testconfig.NewRepository()
gateway = net.NewUAAGateway(config, &testterm.FakeUI{})
auth = NewUAAAuthenticationRepository(gateway, config)
})
AfterEach(func() {
testServer.Close()
})
var setupTestServer = func(request testnet.TestRequest) {
testServer, handler = testnet.NewServer([]testnet.TestRequest{request})
config.SetAuthenticationEndpoint(testServer.URL)
}
Describe("authenticating", func() {
var err error
开发者ID:mandarjog,项目名称:cli,代码行数:31,代码来源:authentication_test.go
示例17: newCurlDependencies
func newCurlDependencies() (deps curlDependencies) {
deps.config = testconfig.NewRepository()
deps.config.SetAccessToken("BEARER my_access_token")
deps.gateway = net.NewCloudControllerGateway(deps.config, time.Now)
return
}
开发者ID:palakmathur,项目名称:cli,代码行数:6,代码来源:curl_test.go
示例18:
"service", "service-auth-tokens", "service-brokers", "set-env", "set-org-role",
"set-space-role", "create-shared-domain", "stacks", "start", "stop",
"target", "unbind-service", "unmap-route", "unset-env", "unset-org-role", "unset-space-role",
"update-buildpack", "update-service-broker", "update-service-auth-token", "update-user-provided-service",
"quotas", "create-quota", "delete-quota", "quota", "set-quota", "install-plugin", "plugins", "uninstall-plugin",
}
var _ = Describe("App", func() {
var (
app *cli.App
cmdRunner *FakeRunner
)
JustBeforeEach(func() {
ui := &testterm.FakeUI{}
config := testconfig.NewRepository()
pluginConfig := &testPluginConfig.FakePluginConfiguration{}
manifestRepo := &testmanifest.FakeManifestRepository{}
repoLocator := api.NewRepositoryLocator(config, map[string]net.Gateway{
"auth": net.NewUAAGateway(config, ui),
"cloud-controller": net.NewCloudControllerGateway(config, time.Now, &testterm.FakeUI{}),
"uaa": net.NewUAAGateway(config, ui),
})
rpcService, _ := rpc.NewRpcService(nil, nil, nil, nil, api.RepositoryLocator{}, nil)
cmdFactory := command_factory.NewFactory(ui, config, manifestRepo, repoLocator, pluginConfig, rpcService)
cmdRunner = &FakeRunner{cmdFactory: cmdFactory}
app = NewApp(cmdRunner, cmdFactory.CommandMetadatas()...)
})
开发者ID:tools-alexuser01,项目名称:cli,代码行数:30,代码来源:app_test.go
示例19:
instance3 := models.AppInstanceFields{}
instance3.State = models.InstanceRunning
instance4 := models.AppInstanceFields{}
instance4.State = models.InstanceStarting
defaultInstanceReponses = [][]models.AppInstanceFields{
[]models.AppInstanceFields{instance1, instance2},
[]models.AppInstanceFields{instance1, instance2},
[]models.AppInstanceFields{instance3, instance4},
}
})
It("fails requirements when not logged in", func() {
requirementsFactory.LoginSuccess = false
cmd := NewStart(new(testterm.FakeUI), testconfig.NewRepository(), &testcmd.FakeAppDisplayer{}, &testapi.FakeApplicationRepository{}, &testapi.FakeAppInstancesRepo{}, &testapi.FakeLogsRepository{})
testcmd.RunCommand(cmd, []string{"some-app-name"}, requirementsFactory)
Expect(testcmd.CommandDidPassRequirements).To(BeFalse())
})
Describe("timeouts", func() {
It("has sane default timeout values", func() {
cmd := NewStart(new(testterm.FakeUI), testconfig.NewRepository(), &testcmd.FakeAppDisplayer{}, &testapi.FakeApplicationRepository{}, &testapi.FakeAppInstancesRepo{}, &testapi.FakeLogsRepository{})
Expect(cmd.StagingTimeout).To(Equal(15 * time.Minute))
Expect(cmd.StartupTimeout).To(Equal(5 * time.Minute))
})
It("can read timeout values from environment variables", func() {
oldStaging := os.Getenv("CF_STAGING_TIMEOUT")
oldStart := os.Getenv("CF_STARTUP_TIMEOUT")
defer func() {
开发者ID:GABONIA,项目名称:cli,代码行数:31,代码来源:start_test.go
注:本文中的github.com/cloudfoundry/cli/testhelpers/configuration.NewRepository函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论