Exemplo n.º 1
0
		currentTime = time.Unix(0, 0)
		clock = func() time.Time { return currentTime }
		config = testconfig.NewRepository()

		ccGateway = NewCloudControllerGateway(config, clock)
		uaaGateway = NewUAAGateway(config)
	})

	Describe("async timeout", func() {
		It("has an async timeout that defaults to a sane value", func() {
			Expect(ccGateway.AsyncTimeout()).To(Equal(ASYNC_REQUEST_TIMEOUT))
		})

		Context("when the config has a positive async timeout", func() {
			It("inherits the async timeout from the config", func() {
				config.SetAsyncTimeout(9001)
				ccGateway = NewCloudControllerGateway((config), time.Now)
				Expect(ccGateway.AsyncTimeout()).To(Equal(9001 * time.Minute))
			})
		})
	})

	Describe("NewRequest", func() {
		var (
			request *Request
			apiErr  error
		)

		BeforeEach(func() {
			request, apiErr = ccGateway.NewRequest("GET", "https://example.com/v2/apps", "BEARER my-access-token", nil)
			Expect(apiErr).NotTo(HaveOccurred())