token string service rainmaker.OrganizationsService organization rainmaker.Organization ) BeforeEach(func() { var err error token = "token" config = rainmaker.Config{ 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)) }) })
var config rainmaker.Config var token string var service *rainmaker.OrganizationsService var organization rainmaker.Organization BeforeEach(func() { var err error token = "token" config = rainmaker.Config{ Host: fakeCloudController.URL(), } 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)) })