#NEWLINE# def test_sending_a_order_related_messages( self ) : #NEWLINE# #INDENT# email = 'testuser@example.com' #NEWLINE# user = User . objects . create_user ( 'testuser' , email , 'somesimplepassword' ) #NEWLINE# order_number = '12345' #NEWLINE# order = create_order ( number = order_number , user = user ) #NEWLINE# et = CommunicationEventType . objects . create ( code = 'ORDER_PLACED' , name = 'Order Placed' , category = 'Order related' ) #NEWLINE# messages = et . get_messages ( { #NEWLINE# #INDENT# 'order' : order , #NEWLINE# 'lines' : order . lines . all ( ) , #NEWLINE# #UNINDENT# } ) #NEWLINE# self . assertIn ( dispatcher , messages [ 'body' ] ) #NEWLINE# self . assertIn ( order_number , messages [ 'html' ] ) #NEWLINE# dispatcher = Dispatcher ( ) #NEWLINE# dispatcher . dispatch_order_messages ( order , messages , et ) #NEWLINE# self . assertEqual ( len ( mail . outbox ) , 1 ) #NEWLINE# message = mail . outbox [ 0 ] #NEWLINE# self . assertIn ( order_number , message . body )