コード例 #1
0
			broker_service := services[0]
			Expect(broker_service.Label).To(Equal("my-service1"))
			Expect(len(broker_service.Plans)).To(Equal(2))
			Expect(broker_service.Plans[0].Name).To(Equal("service-plan1"))
			Expect(broker_service.Plans[1].Name).To(Equal("service-plan2"))
			Expect(broker_service.Plans[0].OrgNames).To(Equal([]string{"org1", "org2"}))

			broker_service2 := services[1]
			Expect(broker_service2.Label).To(Equal("my-service2"))
			Expect(len(broker_service2.Plans)).To(Equal(1))
			Expect(broker_service2.Plans[0].Name).To(Equal("service-plan3"))
		})

		It("raises errors from the service repo", func() {
			serviceRepo.ListServicesFromManyBrokersErr = errors.New("error")
			brokerGuids := []string{"my-service-broker-guid1", "my-service-broker-guid2"}
			_, err := serviceBuilder.GetServicesForManyBrokers(brokerGuids)
			Expect(err).To(HaveOccurred())
		})

		It("raises errors from the plan builder", func() {
			planBuilder.GetPlansForManyServicesWithOrgsReturns(nil, errors.New("error"))
			brokerGuids := []string{"my-service-broker-guid1", "my-service-broker-guid2"}
			_, err := serviceBuilder.GetServicesForManyBrokers(brokerGuids)
			Expect(err).To(HaveOccurred())
		})
	})

	Describe(".GetServiceVisibleToOrg", func() {
		It("Returns a service populated with plans visible to the provided org", func() {