예제 #1
0
def test_read_events(settings, process_external, redis_connection):
    pubsub = redis_connection.get_connection.return_value.pubsub
    pubsub.return_value.listen.side_effect = gen
    listen_for_events()

    process_external.assert_has_calls([
        call(u'app.TestEvent', {'a': 'b'}),
        call(u'app.TestEvent', {'a': 'b'}),
    ])
예제 #2
0
def test_read_events_skip_non_messages(settings, process_external, conn):

    # Given I mock the pubsub connection to return only messages with
    # types different from "message"
    pubsub = conn.get_connection.return_value.pubsub
    pubsub.return_value.listen.side_effect = gen_non_message_events

    # When I listen to the events
    listen_for_events()

    # Then No messages should be processed
    process_external.assert_has_calls([])
예제 #3
0
 def handle(self, *args, **options):
     listen_for_events()