Commit Graph

27 Commits

Author SHA1 Message Date
Steve Howell da66220524 Add propagate_mode to event for topic updates.
(imported from commit c5bd140a46db5b6bc4164c21bcb698776fb0d786)
2014-03-12 21:15:21 -04:00
Steve Howell 9648fd1f9a Add stream_id to event for topic updates.
(imported from commit 2c0ff291672a2576e5812d8c3abdb71256ada61f)
2014-03-12 21:15:21 -04:00
Steve Howell 7a509af38b Add testing for update_message events.
(imported from commit 014cc8f3ed4c56108105e69f17d4894a0bf56c37)
2014-03-12 21:15:20 -04:00
Steve Howell 0eda5cbfec Add event schema checks to misc event tests.
(imported from commit 1c17f972cdd91b8da2169e1cb1cef817f683dd29)
2014-03-11 13:06:17 -04:00
Steve Howell 52478d684c Rename build_update_checker to realm_bot_schema.
(imported from commit ed75e9228a85c5e15290fdd31a0dbbd84327aae9)
2014-03-11 13:06:17 -04:00
Steve Howell 97511067df Sort imports in test_events.py.
(imported from commit 85443b002a3e9231a98d0d1cc85a56e949748ea3)
2014-03-11 13:06:17 -04:00
Jason Michalski 86175e8627 Add events for bots disabling bots
(imported from commit 9de3410555a45038c31341b3857782ffc8246cf7)
2014-03-05 14:16:20 -05:00
Jason Michalski 0165da405f Add events for bot default_events_register_stream changes
(imported from commit 143ed5b110a7f3b37f145dcd3fbe9133a183c7ec)
2014-03-05 14:16:20 -05:00
Jason Michalski f66d864f45 Add event for bot default_sending_stream changes
(imported from commit 7a859cf9f51b6ec1bacb1e3b3cfa9da2c6fbf32f)
2014-03-05 14:16:20 -05:00
Jason Michalski b5ca2631e6 Add event for bot default_all_public_streams changes
(imported from commit f189fb6692cb8c833cc2a1951ad8a4695cc4c27f)
2014-03-05 14:16:20 -05:00
Jason Michalski 3772344e2d Add events for bot avatar_url changes
(imported from commit c058386ce5ef9d89165c44fd853808cfe1f625f4)
2014-03-05 14:16:20 -05:00
Jason Michalski c0d104c110 Add events for bot api_key changes
(imported from commit 44e4e374ee4951c4d984c009ef7af825985fabbf)
2014-03-05 14:16:20 -05:00
Jason Michalski b161f4cff9 Add events for bot full_name changes
(imported from commit 7a8945982a060b208c5459a2b3d130eb84a72922)
2014-03-05 14:16:19 -05:00
Jason Michalski c17ed8dc8c Add bots to page_params and send events on bot creation
(imported from commit ce418b4f056576d57f82d26af621473c730c12d8)
2014-03-05 14:16:19 -05:00
Jason Michalski f3180b774b [schema] Add default user_profile options for register events
Allow bot owners to set which streams their will receive events for
without needing to change a configuration file.

(imported from commit 2b69e519dbc12ffbdba072031a7f7196c9e50e33)
2014-03-05 14:16:18 -05:00
Zev Benjamin 814aed7cbe Send an event when a stream is created, is deleted, becomes occupied, or becomes vacant
A stream is vacant when it has no subscribers and occupied when it has at least
one subscriber.

We have a slightly odd model where stream creation is conflated with
subscription creation.  Streams are created by attempting to subscribe to a
stream that doesn't exist.  We also hide streams with no subscribers from users
to make it seem like they've gone away.  However, we can't actually remove those
streams because we want to preserve history.

This commit moves us towards a separation of these two concepts.  By sending
events for stream creation, occupation, vacancy, and deletion, we allow clients
to directly observe the global state of streams rather than indirectly observing
subscription information.  A more complete solution would involve adding a view
for explicitly creating streams without subscribing to them.

This commit does not handle the intricacies of invite-only streams.  We
currently simply do not send these events for invite-only streams.

(imported from commit 5430e5a5eecefafcdba4f5d4f9aa665556fcc559)
2014-03-03 17:30:58 -05:00
Jessica McKellar 53021bf7d3 Pass per-stream notification settings between frontend and backend.
(imported from commit 42e9b80a4c55e0911d457991d53ce71ca31625bb)
2014-03-03 16:08:31 -05:00
Steve Howell 72ee636571 Use stream_id as key for subscription removals.
Have the server send down the stream's id for removal
events, and have the client use that id to look up the
stream in its internal data structures.  This sets the
stage for eventually just sending the stream id (and not
the stream name) down to clients, once all our clients
are ready to use the stream id.

(imported from commit 922516c98fb79ffad8ae7da0396646663ca54fd0)
2014-02-10 13:23:27 -05:00
Leo Franchi 1c332f5d6a Standardize on 'subscription' as event type name for subscription changes
Our overall guideline is the type names for events are singular, and the list of
events of that type are plural. 'subscriptions' was not following this guideline
and (potentially as a result) had a bug where it was impossible for clients to explicitly
subscribe to subscription change events properly.

(imported from commit 7b3162141fd673746e0489199966c29ea32ee876)
2014-02-06 17:07:38 -05:00
Steve Howell 3a96686cbc Add stream_id to page_params.{subscriptions,unsubscribed}
This isn't used by the client yet, but it should be harmless.

(imported from commit e09ac65ca802f5cf16375b8a93d34e0dfbcb76b4)
2014-02-06 12:09:52 -05:00
Jason Michalski 556dfd2724 Convert function creation to lambdas for pylint
(imported from commit be22408c13736c17a38c50d08016d181f5dbc635)
2014-02-05 11:04:48 -05:00
Steve Howell 7449079191 Validate schema of events in EventsRegisterTest.
For EventsRegisterTest that test updates to streams and
subscriptions, we now validate the events generated by
the actions under test conform to predicted schemas.

We define the schemas with help from the validators code
that is also sometimes used to validate incoming request
parameters for our views.

(imported from commit b4222b920a588e15cccee4a2349c074ca9697448)
2014-02-04 16:25:32 -05:00
Steve Howell 20c0afca1d Simplify custom matchers in EventsRegisterTest.
We now use the same custom matcher for all of our EventRegisterTest
tests.  The "state" that we're tracking has three lists that aren't
really order sensitive, so we turn them into dictionaries keyed
by the primary keys in their structs.  Here are the lists:

    realm_users
    subscriptions
    unsubscribed

(imported from commit 53787c56722b69640368c1b5d67d5d4757f84718)
2014-02-04 13:22:19 -05:00
Steve Howell bf85a3cebc Prevent noops in EventsRegisterTest.
We had a couple tests in EventsRegisterTest that weren't really
testing much, because they were going through codepaths with
authentication problems or actions that didn't affect our
user.  We now assert that the code under test generates
events.

(imported from commit c2f61180cb420d45fa95e137433e9456394bf0ff)
2014-02-03 17:38:23 -05:00
Steve Howell 662459b9e1 Fix do_rename_stream to update the stream's email address.
This change also makes it so that the test_rename_stream()
test exercises the code path.  We need to subscribe the user
to the stream in order to generate events.

(imported from commit 77f965efbf5a766eb8de23486e303fa135b2e638)
2014-02-03 17:38:22 -05:00
Steve Howell cfb2312cb6 Fix test_pointer_events by having it call do_update_pointer.
Before this change, the test_pointer_events test wasn't really
testing anything, because it wasn't getting to do_update_pointer
due to authentication issues and having an invalid message id.

Calling do_update_pointer() directly exercises the events code.

(imported from commit bfac27dcfe659689535f54e0c837427c4f9a8284)
2014-02-03 17:38:21 -05:00
Steve Howell b8b2551e60 Split out test_events.py from tests.py.
(imported from commit a6bfe7db506821fa4747d8bf2ae2af2f4280788d)
2014-02-01 08:14:50 -05:00