"net/http"

	"github.com/michaelklishin/rabbit-hole"
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
	"github.com/pivotal-cf/brokerapi"
	"github.com/pivotal-cf/cf-rabbitmq-broker"
	"github.com/pivotal-cf/cf-rabbitmq-broker/fakes"
	"github.com/pivotal-golang/lager/lagertest"
)

var _ = Describe("BrokerBinding", func() {
	var (
		client               *fakes.FakeAPIClient
		config               *rabbitbroker.Config
		credentialsGenerator *fakes.FakeCredentialsGenerator
		broker               brokerapi.ServiceBroker
		binder               *fakes.FakeBindingInfoBuilder
	)

	BeforeEach(func() {
		config = &rabbitbroker.Config{}
		client = new(fakes.FakeAPIClient)
		client.PutUserReturns(&http.Response{StatusCode: http.StatusNoContent}, nil)
		client.UpdatePermissionsInReturns(&http.Response{StatusCode: http.StatusNoContent}, nil)
		credentialsGenerator = new(fakes.FakeCredentialsGenerator)
		binder = new(fakes.FakeBindingInfoBuilder)
		broker = rabbitbroker.New(config, client, credentialsGenerator, lagertest.NewTestLogger("test"), binder)
	})

	It("uses generated user credentials", func() {
	"fmt"
	"net/http"

	"github.com/michaelklishin/rabbit-hole"
	"github.com/pivotal-cf/brokerapi"
	"github.com/pivotal-cf/cf-rabbitmq-broker"
	"github.com/pivotal-cf/cf-rabbitmq-broker/fakes"
	"github.com/pivotal-golang/lager/lagertest"
)

var _ = Describe("Broker Provisioning and Deprovisioning", func() {
	var (
		client               *fakes.FakeAPIClient
		config               *rabbitbroker.Config
		broker               brokerapi.ServiceBroker
		credentialsGenerator *fakes.FakeCredentialsGenerator
		logger               *lagertest.TestLogger
	)

	BeforeEach(func() {
		config = defaultConfig()
		client = new(fakes.FakeAPIClient)
		credentialsGenerator = new(fakes.FakeCredentialsGenerator)
		logger = lagertest.NewTestLogger("test")
		broker = rabbitbroker.New(config, client, credentialsGenerator, logger, nil)
	})

	Context("Provision", func() {

		BeforeEach(func() {