Example #1
0
			Expect(len(broker.Services[0].Plans)).To(Equal(2))
			Expect(len(broker.Services)).To(Equal(2))
		})
	})

	Describe(".GetAllServiceBrokers", func() {
		It("returns an error if we cannot list all brokers", func() {
			brokerRepo.ListServiceBrokersReturns(errors.New("Error finding service brokers"))

			_, err := brokerBuilder.GetAllServiceBrokers()
			Expect(err).To(HaveOccurred())
		})

		It("returns an error if we cannot list the services for a broker", func() {
			brokerRepo.ListServiceBrokersStub = func(callback func(models.ServiceBroker) bool) error {
				callback(serviceBroker1)
				return nil
			}

			serviceBuilder.GetServicesForManyBrokersReturns(nil, errors.New("Cannot find services"))

			_, err := brokerBuilder.GetAllServiceBrokers()
			Expect(err).To(HaveOccurred())
		})

		It("returns all service brokers populated with their services", func() {
			brokerRepo.ListServiceBrokersStub = func(callback func(models.ServiceBroker) bool) error {
				callback(serviceBroker1)
				return nil
			}
			serviceBuilder.GetServicesForManyBrokersReturns(services, nil)
Example #2
0
	})

	It("lists service brokers", func() {
		repo.ListServiceBrokersStub = func(callback func(models.ServiceBroker) bool) error {
			sbs := []models.ServiceBroker{
				{
					Name: "service-broker-to-list-a",
					GUID: "service-broker-to-list-guid-a",
					URL:  "http://service-a-url.com",
				},
				{
					Name: "service-broker-to-list-b",
					GUID: "service-broker-to-list-guid-b",
					URL:  "http://service-b-url.com",
				},
				{
					Name: "service-broker-to-list-c",
					GUID: "service-broker-to-list-guid-c",
					URL:  "http://service-c-url.com",
				},
			}

			for _, sb := range sbs {
				callback(sb)
			}

			return nil
		}

		testcmd.RunCLICommand("service-brokers", []string{}, requirementsFactory, updateCommandDependency, false)