本文整理汇总了Golang中github.com/cloudfoundry/cli/testhelpers/cloudcontrollergateway.NewTestCloudControllerGateway函数的典型用法代码示例。如果您正苦于以下问题:Golang NewTestCloudControllerGateway函数的具体用法?Golang NewTestCloudControllerGateway怎么用?Golang NewTestCloudControllerGateway使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了NewTestCloudControllerGateway函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: createServiceSummaryRepo
func createServiceSummaryRepo(req testnet.TestRequest) (ts *httptest.Server, handler *testnet.TestHandler, repo ServiceSummaryRepository) {
ts, handler = testnet.NewServer([]testnet.TestRequest{req})
configRepo := testconfig.NewRepositoryWithDefaults()
configRepo.SetAPIEndpoint(ts.URL)
gateway := cloudcontrollergateway.NewTestCloudControllerGateway(configRepo)
repo = NewCloudControllerServiceSummaryRepository(configRepo, gateway)
return
}
开发者ID:yingkitw,项目名称:cli,代码行数:8,代码来源:service_summary_test.go
示例2: createAppRepo
func createAppRepo(requests []testnet.TestRequest) (ts *httptest.Server, handler *testnet.TestHandler, repo ApplicationRepository) {
ts, handler = testnet.NewServer(requests)
configRepo := testconfig.NewRepositoryWithDefaults()
configRepo.SetAPIEndpoint(ts.URL)
gateway := cloudcontrollergateway.NewTestCloudControllerGateway(configRepo)
repo = NewCloudControllerApplicationRepository(configRepo, gateway)
return
}
开发者ID:yingkitw,项目名称:cli,代码行数:8,代码来源:applications_test.go
示例3: createUserProvidedServiceInstanceRepo
func createUserProvidedServiceInstanceRepo(req []testnet.TestRequest) (ts *httptest.Server, handler *testnet.TestHandler, repo UserProvidedServiceInstanceRepository) {
ts, handler = testnet.NewServer(req)
configRepo := testconfig.NewRepositoryWithDefaults()
configRepo.SetAPIEndpoint(ts.URL)
gateway := cloudcontrollergateway.NewTestCloudControllerGateway(configRepo)
repo = NewCCUserProvidedServiceInstanceRepository(configRepo, gateway)
return
}
开发者ID:yingkitw,项目名称:cli,代码行数:8,代码来源:user_provided_service_instances_test.go
示例4: createOrganizationRepo
func createOrganizationRepo(reqs ...testnet.TestRequest) (testserver *httptest.Server, handler *testnet.TestHandler, repo OrganizationRepository) {
testserver, handler = testnet.NewServer(reqs)
configRepo := testconfig.NewRepositoryWithDefaults()
configRepo.SetAPIEndpoint(testserver.URL)
gateway := cloudcontrollergateway.NewTestCloudControllerGateway(configRepo)
repo = NewCloudControllerOrganizationRepository(configRepo, gateway)
return
}
开发者ID:yingkitw,项目名称:cli,代码行数:9,代码来源:organizations_test.go
示例5: createPasswordRepo
func createPasswordRepo(req testnet.TestRequest) (passwordServer *httptest.Server, handler *testnet.TestHandler, repo PasswordRepository) {
passwordServer, handler = testnet.NewServer([]testnet.TestRequest{req})
configRepo := testconfig.NewRepositoryWithDefaults()
configRepo.SetUaaEndpoint(passwordServer.URL)
gateway := cloudcontrollergateway.NewTestCloudControllerGateway(configRepo)
repo = NewCloudControllerPasswordRepository(configRepo, gateway)
return
}
开发者ID:yingkitw,项目名称:cli,代码行数:9,代码来源:password_test.go
示例6: createAppInstancesRepo
func createAppInstancesRepo(requests []testnet.TestRequest) (ts *httptest.Server, handler *testnet.TestHandler, repo AppInstancesRepository) {
ts, handler = testnet.NewServer(requests)
space := models.SpaceFields{}
space.GUID = "my-space-guid"
configRepo := testconfig.NewRepositoryWithDefaults()
configRepo.SetAPIEndpoint(ts.URL)
gateway := cloudcontrollergateway.NewTestCloudControllerGateway(configRepo)
repo = NewCloudControllerAppInstancesRepository(configRepo, gateway)
return
}
开发者ID:yingkitw,项目名称:cli,代码行数:10,代码来源:app_instances_test.go
示例7:
listFilesServer := httptest.NewServer(http.HandlerFunc(listFilesEndpoint))
defer listFilesServer.Close()
req := apifakes.NewCloudControllerTestRequest(testnet.TestRequest{
Method: "GET",
Path: "/v2/apps/my-app-guid/instances/1/files/some/path",
Response: testnet.TestResponse{
Status: http.StatusTemporaryRedirect,
Header: http.Header{
"Location": {fmt.Sprintf("%s/some/path", listFilesServer.URL)},
},
},
})
listFilesRedirectServer, handler := testnet.NewServer([]testnet.TestRequest{req})
defer listFilesRedirectServer.Close()
configRepo := testconfig.NewRepositoryWithDefaults()
configRepo.SetAPIEndpoint(listFilesRedirectServer.URL)
gateway := cloudcontrollergateway.NewTestCloudControllerGateway(configRepo)
repo := NewCloudControllerAppFilesRepository(configRepo, gateway)
list, err := repo.ListFiles("my-app-guid", 1, "some/path")
Expect(handler).To(HaveAllRequestsCalled())
Expect(err).ToNot(HaveOccurred())
Expect(list).To(Equal(expectedResponse))
})
})
开发者ID:yingkitw,项目名称:cli,代码行数:29,代码来源:app_files_test.go
示例8:
BeforeEach(func() {
currentTime = time.Unix(0, 0)
clock = func() time.Time { return currentTime }
config = testconfig.NewRepository()
ccGateway = NewCloudControllerGateway(config, clock, &testterm.FakeUI{}, new(tracefakes.FakePrinter))
ccGateway.PollingThrottle = 3 * time.Millisecond
uaaGateway = NewUAAGateway(config, &testterm.FakeUI{}, new(tracefakes.FakePrinter))
})
Describe("async timeout", func() {
Context("when the config has a positive async timeout", func() {
It("inherits the async timeout from the config", func() {
config.SetAsyncTimeout(9001)
ccGateway = cloudcontrollergateway.NewTestCloudControllerGateway(config)
Expect(ccGateway.AsyncTimeout()).To(Equal(9001 * time.Minute))
})
})
})
Describe("Connection errors", func() {
var oldNewHTTPClient func(tr *http.Transport, dumper RequestDumper) HTTPClientInterface
BeforeEach(func() {
client = new(netfakes.FakeHTTPClientInterface)
oldNewHTTPClient = NewHTTPClient
NewHTTPClient = func(tr *http.Transport, dumper RequestDumper) HTTPClientInterface {
return client
}
开发者ID:yingkitw,项目名称:cli,代码行数:30,代码来源:gateway_test.go
示例9: newCurlDependencies
func newCurlDependencies() (deps curlDependencies) {
deps.config = testconfig.NewRepository()
deps.config.SetAccessToken("BEARER my_access_token")
deps.gateway = cloudcontrollergateway.NewTestCloudControllerGateway(deps.config)
return
}
开发者ID:yingkitw,项目名称:cli,代码行数:6,代码来源:curl_test.go
注:本文中的github.com/cloudfoundry/cli/testhelpers/cloudcontrollergateway.NewTestCloudControllerGateway函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论