Ejemplo n.º 1
0
				It("returns an empty set", func() {
					brokerBuilder.GetBrokerWithSpecifiedServiceReturns(models.ServiceBroker{}, nil)
					brokers, err := actor.FilterBrokers("my-service-broker", "my-service2", "")

					Expect(len(brokers)).To(Equal(0))
					Expect(err).To(BeNil())
				})
			})
		})

		Context("when the -b AND the -o flags are passed", func() {
			It("returns the intersection set", func() {
				serviceBroker1.Services = []models.ServiceOffering{service1}
				returnedBroker := serviceBroker1

				serviceBuilder.GetServiceVisibleToOrgReturns(service1, nil)
				brokerBuilder.AttachSpecificBrokerToServicesReturns(returnedBroker, nil)

				brokers, err := actor.FilterBrokers("my-service-broker", "", "org1")
				Expect(err).NotTo(HaveOccurred())

				Expect(len(brokers)).To(Equal(1))
				Expect(len(brokers[0].Services)).To(Equal(1))

				Expect(brokers[0].Services[0].Label).To(Equal("my-service1"))
				Expect(brokers[0].Services[0].Guid).To(Equal("service-guid1"))
			})
		})

		Context("when the -e AND the -o flags are passed", func() {
			It("returns the intersection set", func() {