當前位置: 首頁>>代碼示例>>Golang>>正文


Golang cloudcontrollergateway.NewTestCloudControllerGateway函數代碼示例

本文整理匯總了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;未經允許,請勿轉載。