本文整理匯總了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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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
}
示例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))
})
})
示例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
}
示例9: newCurlDependencies
func newCurlDependencies() (deps curlDependencies) {
deps.config = testconfig.NewRepository()
deps.config.SetAccessToken("BEARER my_access_token")
deps.gateway = cloudcontrollergateway.NewTestCloudControllerGateway(deps.config)
return
}