func (m *Mother) OrganizationStrategy() services.OrganizationStrategy { env := NewEnvironment() cloudController := cf.NewCloudController(env.CCHost, !env.VerifySSL) uaaClient := uaa.NewZonedUAAClient(env.UAAClientID, env.UAAClientSecret, env.VerifySSL, UAAPublicKey) tokenLoader := uaa.NewTokenLoader(uaaClient) organizationLoader := services.NewOrganizationLoader(cloudController) findsUserGUIDs := services.NewFindsUserGUIDs(cloudController, uaaClient) enqueuer := m.Enqueuer() return services.NewOrganizationStrategy(tokenLoader, organizationLoader, findsUserGUIDs, enqueuer, m.V2Enqueuer()) }
var _ = Describe("OrganizationLoader", func() { Describe("Load", func() { var ( loader services.OrganizationLoader cc *mocks.CloudController ) BeforeEach(func() { cc = mocks.NewCloudController() cc.LoadOrganizationCall.Returns.Organization = cf.CloudControllerOrganization{ GUID: "org-001", Name: "org-name", } loader = services.NewOrganizationLoader(cc) }) It("returns the org", func() { org, err := loader.Load("org-001", "some-token") Expect(err).NotTo(HaveOccurred()) Expect(org).To(Equal(cf.CloudControllerOrganization{ GUID: "org-001", Name: "org-name", })) Expect(cc.LoadOrganizationCall.Receives.OrgGUID).To(Equal("org-001")) Expect(cc.LoadOrganizationCall.Receives.Token).To(Equal("some-token")) }) Context("when the org cannot be found", func() {