<s> from mock import Mock <EOL> from nameko . events import event_handler <EOL> from nameko . standalone . events import event_dispatcher <EOL> from nameko . testing . services import entrypoint_waiter <EOL> handler_called = Mock ( ) <EOL> class Service ( object ) : <EOL> name = '<STR_LIT>' <EOL> @ event_handler ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> def handler ( self , msg ) : <EOL> handler_called ( msg ) <EOL> def test_dispatch ( container_factory , rabbit_config ) : <EOL> config = rabbit_config <EOL> container = container_factory ( Service , config ) <EOL> container . start ( ) <EOL> msg = "<STR_LIT>" <EOL> dispatch = event_dispatcher ( config ) <EOL> with entrypoint_waiter ( container , '<STR_LIT>' , timeout = <NUM_LIT:1> ) : <EOL> dispatch ( '<STR_LIT>' , '<STR_LIT>' , msg ) <EOL> handler_called . assert_called_once_with ( msg ) </s>
