#NEWLINE# @ pytest . mark . parametrize ( 'jobstore' , [ None , 'bar' ] , ids = [ 'all jobstores' , 'specific jobstore' ] ) #NEWLINE# def test_print_jobs( self , scheduler , jobstore ) : #NEWLINE# #INDENT# outfile = StringIO ( ) #NEWLINE# bar_job = MagicMock ( Job ) #NEWLINE# bar_job . __str__ = bar_job . __unicode__ = MagicMock ( return_value = 'bar job 1' ) #NEWLINE# pending_bar_job = MagicMock ( Job ) #NEWLINE# pending_bar_job . __str__ = pending_bar_job . __unicode__ = MagicMock ( return_value = 'pending bar job 1' ) #NEWLINE# pending_baz_job = MagicMock ( Job ) #NEWLINE# pending_baz_job . __str__ = pending_baz_job . __unicode__ = MagicMock ( return_value = 'pending baz job 1' ) #NEWLINE# scheduler . _jobstores = OrderedDict ( [ ( 'bar' , MagicMock ( BaseJobStore , get_all_jobs = ( lambda : [ bar_job ] ) ) ) , ( 'baz' , MagicMock ( BaseJobStore , get_all_jobs = ( lambda : [ ] ) ) ) ] ) #NEWLINE# scheduler . _pending_jobs = [ ( pending_bar_job , 'bar' , False ) , ( pending_baz_job , 'baz' , False ) ] #NEWLINE# scheduler . print_jobs ( outfile , outfile ) #NEWLINE# if jobstore : #NEWLINE# #INDENT# assert ( outfile . getvalue ( ) == 'Pending jobs:\n    pending bar job 1\nJobstore bar:\n    bar job 1\n' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# assert ( outfile . getvalue ( ) == 'Pending jobs:\n    pending bar job 1\n    pending baz job 1\nJobstore bar:\n    bar job 1\nJobstore baz:\n    No scheduled jobs\n' )