Beispiel #1
0
			callBindService([]string{"my-app", "my-service"})

			Expect(ui.Outputs()).To(ContainSubstrings(
				[]string{"Binding service", "my-service", "my-app", "my-org", "my-space", "my-user"},
				[]string{"OK"},
				[]string{"TIP", "my-app"},
			))

			Expect(serviceBindingRepo.CreateCallCount()).To(Equal(1))
			serviceInstanceGUID, applicationGUID, _ := serviceBindingRepo.CreateArgsForCall(0)
			Expect(serviceInstanceGUID).To(Equal("my-service-guid"))
			Expect(applicationGUID).To(Equal("my-app-guid"))
		})

		It("warns the user when the service instance is already bound to the given app", func() {
			serviceBindingRepo.CreateReturns(errors.NewHTTPError(http.StatusBadRequest, errors.ServiceBindingAppServiceTaken, ""))
			callBindService([]string{"my-app", "my-service"})

			Expect(ui.Outputs()).To(ContainSubstrings(
				[]string{"Binding service"},
				[]string{"OK"},
				[]string{"my-app", "is already bound", "my-service"},
			))
		})

		It("warns the user when the error is non HTTPError ", func() {
			serviceBindingRepo.CreateReturns(errors.New("1001"))
			callBindService([]string{"my-app1", "my-service1"})
			Expect(ui.Outputs()).To(ContainSubstrings(
				[]string{"Binding service", "my-service", "my-app", "my-org", "my-space", "my-user"},
				[]string{"FAILED"},