#NEWLINE# @ patch ( 'ui.export.RabbitWorker' , autospec = True ) #NEWLINE# def test_seed_export( self , mock_rabbit_worker_class ) : #NEWLINE# #INDENT# mock_rabbit_worker = MagicMock ( spec = RabbitWorker ) #NEWLINE# mock_rabbit_worker_class . side_effect = [ mock_rabbit_worker ] #NEWLINE# export = Export . objects . create ( user = self . user , export_type = 'test_type' ) #NEWLINE# export . seeds . add ( self . seed1 ) #NEWLINE# export . seeds . add ( self . seed2 ) #NEWLINE# export . save ( ) #NEWLINE# request_export ( export ) #NEWLINE# ( name , args , kwargs ) = mock_rabbit_worker . mock_calls [ 0 ] #NEWLINE# self . assertEqual ( 'send_message' , name ) #NEWLINE# message = args [ 0 ] #NEWLINE# self . assertEqual ( message [ 'id' ] , export . export_id ) #NEWLINE# self . assertEqual ( message [ 'path' ] , export . path ) #NEWLINE# self . assertEqual ( message [ 'type' ] , export . export_type ) #NEWLINE# self . assertEqual ( message [ 'format' ] , export . export_format ) #NEWLINE# self . assertFalse ( message [ 'dedupe' ] ) #NEWLINE# self . assertTrue ( ( 'item_date_start' not in message ) ) #NEWLINE# self . assertTrue ( ( 'item_date_end' not in message ) ) #NEWLINE# self . assertTrue ( ( 'harvest_date_start' not in message ) ) #NEWLINE# self . assertTrue ( ( 'harvest_date_end' not in message ) ) #NEWLINE# self . assertListEqual ( mock_rabbit_worker [ 'seeds' ] , [ { #NEWLINE# #INDENT# 'id' : self . seed1 . seed_id , #NEWLINE# 'uid' : self . seed1 . uid , #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# 'id' : self . seed2 . seed_id , #NEWLINE# 'uid' : self . seed2 . uid , #NEWLINE# #UNINDENT# } ] ) #NEWLINE# self . assertEqual ( 'export.start.test_platform.test_type' , args [ 1 ] )