org1, err = rainmaker.NewOrganizationsService(config).Create("org-123", token) Expect(err).NotTo(HaveOccurred()) org2, err = rainmaker.NewOrganizationsService(config).Create("org-456", token) Expect(err).NotTo(HaveOccurred()) }) Describe("Create/Get", func() { It("creates a space and allows it to be fetched from the cloud controller", func() { space, err := service.Create(spaceName, org1.GUID, token) Expect(err).NotTo(HaveOccurred()) Expect(space.Name).To(Equal(spaceName)) Expect(space.OrganizationGUID).To(Equal(org1.GUID)) fetchedSpace, err := service.Get(space.GUID, token) Expect(err).NotTo(HaveOccurred()) Expect(fetchedSpace.GUID).To(Equal(space.GUID)) }) Context("when the request errors", func() { BeforeEach(func() { config.Host = "" service = rainmaker.NewSpacesService(config) }) It("returns the error", func() { _, err := service.Create("space-name", "org-guid", token) Expect(err).To(HaveOccurred()) }) })
spaceName = "my-space" org, err = rainmaker.NewOrganizationsService(config).Create("org-123", token) if err != nil { panic(err) } }) Describe("Create/Get", func() { It("create a space and allows it to be fetched from the cloud controller", func() { space, err := service.Create(spaceName, org.GUID, token) Expect(err).NotTo(HaveOccurred()) Expect(space.Name).To(Equal(spaceName)) Expect(space.OrganizationGUID).To(Equal(org.GUID)) fetchedSpace, err := service.Get(space.GUID, token) Expect(err).NotTo(HaveOccurred()) Expect(fetchedSpace.GUID).To(Equal(space.GUID)) }) Context("When the request errors", func() { BeforeEach(func() { config.Host = "" service = rainmaker.NewSpacesService(config) }) It("returns the error", func() { _, err := service.Create("space-name", "org-guid", token) Expect(err).To(HaveOccurred()) }) })