func (m *Mother) EveryoneStrategy() services.EveryoneStrategy { env := NewEnvironment() uaaClient := uaa.NewZonedUAAClient(env.UAAClientID, env.UAAClientSecret, env.VerifySSL, UAAPublicKey) tokenLoader := uaa.NewTokenLoader(uaaClient) allUsers := services.NewAllUsers(uaaClient) enqueuer := m.Enqueuer() return services.NewEveryoneStrategy(tokenLoader, allUsers, enqueuer, m.V2Enqueuer()) }
} tokenClaims := map[string]interface{}{ "client_id": "mister-client", "exp": int64(3404281214), "iss": "my-uaa-host", "scope": []string{"notifications.write"}, } tokenLoader = mocks.NewTokenLoader() token = helpers.BuildToken(tokenHeader, tokenClaims) tokenLoader.LoadCall.Returns.Token = token v1Enqueuer = mocks.NewEnqueuer() v2Enqueuer = mocks.NewV2Enqueuer() allUsers = mocks.NewAllUsers() allUsers.AllUserGUIDsCall.Returns.GUIDs = []string{"user-380", "user-319"} strategy = services.NewEveryoneStrategy(tokenLoader, allUsers, v1Enqueuer, v2Enqueuer) }) Describe("Dispatch", func() { Context("when the dispatch JobType is unspecified", func() { It("call enqueuer.Enqueue with the correct arguments for an organization", func() { _, err := strategy.Dispatch(services.Dispatch{ Connection: conn, Kind: services.DispatchKind{ ID: "welcome_user", Description: "Your Official Welcome", }, TemplateID: "some-template-id", Client: services.DispatchClient{ ID: "my-client", Description: "Welcome system",