#NEWLINE# def test_dispatch_msg_errors_to( dispatcher , monkeypatch ) : #NEWLINE# #INDENT# monkeypatch . setattr ( 'slackbot.dispatcher.Message' , FakeMessage ) #NEWLINE# dispatcher . _errors_to = 'D12345' #NEWLINE# dispatcher . dispatch_msg ( [ 'reply_to' , { #NEWLINE# #INDENT# 'text' : 'raising' , #NEWLINE# 'channel' : FAKE_CHANNEL , #NEWLINE# #UNINDENT# } ] ) #NEWLINE# assert ( len ( dispatcher . _client . rtm_messages ) == 2 ) #NEWLINE# user_error = dispatcher . _client . rtm_messages [ 0 ] #NEWLINE# assert ( user_error [ 0 ] == FAKE_CHANNEL ) #NEWLINE# error = dispatcher . _client . rtm_messages [ 1 ] #NEWLINE# assert ( error [ 0 ] == 'D12345' ) #NEWLINE# assert ( 'RuntimeError' in error [ 1 ] )