コード例 #1
0
				GUID:       "service-guid2",
				BrokerGUID: "my-service-broker-guid2",
			},
		}

		v1Service = models.ServiceOffering{
			ServiceOfferingFields: models.ServiceOfferingFields{
				Label:      "v1Service",
				GUID:       "v1Service-guid",
				BrokerGUID: "my-service-broker-guid1",
				Provider:   "IAmV1",
			},
		}

		serviceOfferings := models.ServiceOfferings([]models.ServiceOffering{service1, v1Service})
		serviceRepo.FindServiceOfferingsByLabelReturns(serviceOfferings, nil)
		serviceRepo.GetServiceOfferingByGUIDReturns(service1, nil)
		serviceRepo.ListServicesFromBrokerReturns([]models.ServiceOffering{service1}, nil)
		serviceRepo.ListServicesFromManyBrokersReturns([]models.ServiceOffering{service1, service2}, nil)

		plan1 = models.ServicePlanFields{
			Name:                "service-plan1",
			GUID:                "service-plan1-guid",
			ServiceOfferingGUID: "service-guid1",
			OrgNames:            []string{"org1", "org2"},
		}

		plan2 = models.ServicePlanFields{
			Name:                "service-plan2",
			GUID:                "service-plan2-guid",
			ServiceOfferingGUID: "service-guid1",
コード例 #2
0
				Expect(err).NotTo(HaveOccurred())
				Expect(actualRequirements).To(ContainElement(maxAPIVersionRequirement))
			})
		})
	})

	Describe("Execute", func() {
		var runCLIErr error

		BeforeEach(func() {
			err := flagContext.Parse("service-name")
			Expect(err).NotTo(HaveOccurred())
			_, err = cmd.Requirements(factory, flagContext)
			Expect(err).NotTo(HaveOccurred())
			ui.Inputs = []string{"n"}
			serviceRepo.FindServiceOfferingsByLabelReturns([]models.ServiceOffering{{}}, nil)
		})

		JustBeforeEach(func() {
			runCLIErr = cmd.Execute(flagContext)
		})

		It("tries to find the service offering by label", func() {
			Expect(runCLIErr).NotTo(HaveOccurred())
			Expect(serviceRepo.FindServiceOfferingsByLabelCallCount()).To(Equal(1))
			name := serviceRepo.FindServiceOfferingsByLabelArgsForCall(0)
			Expect(name).To(Equal("service-name"))
		})

		Context("when finding the service offering succeeds", func() {
			BeforeEach(func() {