Host: fakeCloudController.URL(), } client := rainmaker.NewClient(config) service = client.Organizations organization, err = service.Create("test-org", token) Expect(err).NotTo(HaveOccurred()) }) Describe("Create", func() { It("creates a new organization that can be fetched from the API", func() { organization, err := service.Create("my-new-org", token) Expect(err).NotTo(HaveOccurred()) Expect(organization.Name).To(Equal("my-new-org")) fetchedOrg, err := service.Get(organization.GUID, token) Expect(err).NotTo(HaveOccurred()) Expect(fetchedOrg).To(Equal(organization)) }) }) Describe("List", func() { var ( org1 rainmaker.Organization ) BeforeEach(func() { var err error org1, err = service.Create("first org", token) Expect(err).NotTo(HaveOccurred())
client := rainmaker.NewClient(config) service = client.Organizations organization, err = service.Create("test-org", token) if err != nil { panic(err) } }) Describe("Create", func() { It("creates a new organization that can be fetched from the API", func() { organization, err := service.Create("my-new-org", token) Expect(err).NotTo(HaveOccurred()) Expect(organization.Name).To(Equal("my-new-org")) fetchedOrg, err := service.Get(organization.GUID, token) Expect(err).NotTo(HaveOccurred()) Expect(fetchedOrg).To(Equal(organization)) }) }) Describe("Get", func() { It("returns the organization matching the given GUID", func() { var err error orgGUID := organization.GUID organization, err = service.Get(orgGUID, token) Expect(err).NotTo(HaveOccurred()) Expect(organization.GUID).To(Equal(orgGUID)) }) })