Exemplo n.º 1
0
var _ = Describe("#serviceUnbind", func() {
	var (
		serviceUnbindResult bool
		serviceUnbindErr    error
	)

	Context("when serviceUnbind succeed", func() {
		BeforeEach(func() {
			serviceUnbindErr = nil
			serviceUnbindResult = true
		})

		It("serviceUnbind v2/service_instances/aws-service-guid/service_bindings/aws-service-binding returns models.Empty", func() {

			parameters, err := utils.ReadTestFixtures("serviceUnbind.json")
			Expect(err).ToNot(HaveOccurred())

			httpClient := utils.NewHttpClient("username", "apiKey")
			response, serviceUnbindErr := httpClient.DoRawHttpRequest("v2/service_instances/aws-service-guid/service_bindings/aws-service-binding", "DELETE", parameters)
			if strings.Contains(string(response), "404") {
				serviceUnbindResult = false
			}
			Expect(serviceUnbindErr).ToNot(HaveOccurred())
			Expect(string(response)).ToNot(ContainSubstring("Unprocessable Entity"))
			Expect(serviceUnbindResult).To(BeTrue())
		})

	})

	Context("when serviceUnbind fail", func() {
var _ = Describe("#updateServiceInstance", func() {
	var (
		updateServiceInstanceResult bool
		updateServiceInstanceErr    error
	)

	Context("when updateServiceInstance succeed", func() {
		BeforeEach(func() {
			updateServiceInstanceErr = nil
			updateServiceInstanceResult = true
		})

		It("updateServiceInstance v2/createServiceInstance/aws-service-guid returns models.Empty", func() {

			parameters, err := utils.ReadTestFixtures("updateServiceInstance.json")
			Expect(err).ToNot(HaveOccurred())

			httpClient := utils.NewHttpClient("username", "apiKey")
			response, updateServiceInstanceErr := httpClient.DoRawHttpRequest("v2/createServiceInstance/aws-service-guid", "PATCH", parameters)
			if strings.Contains(string(response), "404") {
				updateServiceInstanceResult = false
			}
			Expect(updateServiceInstanceErr).ToNot(HaveOccurred())
			Expect(string(response)).ToNot(ContainSubstring("Unprocessable Entity"))
			Expect(updateServiceInstanceResult).To(BeTrue())
		})

	})

	Context("when updateServiceInstance fail", func() {
var _ = Describe("#deprovisionServiceInstance", func() {
	var (
		deprovisionServiceInstanceResult bool
		deprovisionServiceInstanceErr    error
	)

	Context("when deprovisionServiceInstance succeed", func() {
		BeforeEach(func() {
			deprovisionServiceInstanceErr = nil
			deprovisionServiceInstanceResult = true
		})

		It("deprovisionServiceInstance v2/service_instances/aws-service-guid returns models.Empty", func() {

			parameters, err := utils.ReadTestFixtures("deprovisionServiceInstance.json")
			Expect(err).ToNot(HaveOccurred())

			httpClient := utils.NewHttpClient("username", "apiKey")
			response, deprovisionServiceInstanceErr := httpClient.DoRawHttpRequest("v2/service_instances/aws-service-guid", "DELETE", parameters)
			if strings.Contains(string(response), "404") {
				deprovisionServiceInstanceResult = false
			}
			Expect(deprovisionServiceInstanceErr).ToNot(HaveOccurred())
			Expect(string(response)).ToNot(ContainSubstring("Unprocessable Entity"))
			Expect(deprovisionServiceInstanceResult).To(BeTrue())
		})

	})

	Context("when deprovisionServiceInstance fail", func() {
Exemplo n.º 4
0
var _ = Describe("#serviceBind", func() {
	var (
		serviceBindResult bool
		serviceBindErr    error
	)

	Context("when serviceBind succeed", func() {
		BeforeEach(func() {
			serviceBindErr = nil
			serviceBindResult = true
		})

		FIt("serviceBind v2/service_instances/aws-service-guid/service_bindings/aws-service-binding returns models.BindingResponse", func() {

			parameters, err := utils.ReadTestFixtures("serviceBind.json")
			Expect(err).ToNot(HaveOccurred())

			httpClient := utils.NewHttpClient("username", "apiKey")
			response, serviceBindErr := httpClient.DoRawHttpRequest("v2/service_instances/aws-service-guid/service_bindings/aws-service-binding", "PUT", parameters)
			if strings.Contains(string(response), "404") {
				serviceBindResult = false
			}
			Expect(serviceBindErr).ToNot(HaveOccurred())
			Expect(string(response)).ToNot(ContainSubstring("Unprocessable Entity"))
			Expect(serviceBindResult).To(BeTrue())
		})

		FIt("serviceBind v2/service_instances/aws-service-guid/service_bindings/aws-service-binding with app_id", func() {
			parameters, err := utils.ReadTestFixtures("serviceBindWithAppid.json")
			Expect(err).ToNot(HaveOccurred())