#NEWLINE# def test_no_processor( self ) : #NEWLINE# #INDENT# response = self . client . get ( '/api/async/preview/' , HTTP_ACCEPT = 'application/json' ) #NEWLINE# self . assertEqual ( response . status_code , HttpResponseRedirect . status_code ) #NEWLINE# normal_job_id = response [ 'Location' ] . split ( '/' ) [ ( - 2 ) ] #NEWLINE# response = self . client . get ( '/api/async/preview/?processor=manager' , HTTP_ACCEPT = 'application/json' ) #NEWLINE# self . assertEqual ( response . status_code , HttpResponseRedirect . status_code ) #NEWLINE# valid_job_id = response [ 'Location' ] . split ( '/' ) [ ( - 2 ) ] #NEWLINE# response = self . client . get ( '/api/async/preview/?processor=INVALID' , HTTP_ACCEPT = 'application/json' ) #NEWLINE# self . assertEqual ( response . status_code , HttpResponseRedirect . status_code ) #NEWLINE# invalid_job_id = response [ 'Location' ] . split ( '/' ) [ ( - 2 ) ] #NEWLINE# self . assertEqual ( utils . get_job_count ( ) , 3 ) #NEWLINE# for job_id in [ normal_job_id , valid_job_id , invalid_job_id ] : #NEWLINE# #INDENT# self . assert_job_status_equal ( utils . get_job ( job_id ) , 'queued' ) #NEWLINE# #UNINDENT# utils . run_jobs ( ) #NEWLINE# time . sleep ( 3 ) #NEWLINE# for job_id in [ normal_job_id , invalid_job_id , valid_job_id ] : #NEWLINE# #INDENT# self . assert_job_status_equal ( utils . get_job ( job_id ) , 'finished' ) #NEWLINE# #UNINDENT# response = self . client . get ( '/api/jobs/{0}/result/' . format ( normal_job_id ) , HTTP_ACCEPT = 'application/json' ) #NEWLINE# content = json . loads ( response . content ) #NEWLINE# self . assertEqual ( len ( content [ 'items' ] ) , 6 ) #NEWLINE# response = self . client . get ( '/api/jobs/{0}/result/' . format ( valid_job_id ) , HTTP_ACCEPT = 'application/json' ) #NEWLINE# content = json . loads ( response . content ) #NEWLINE# self . assertEqual ( len ( content [ 'items' ] ) , 1 ) #NEWLINE# response = self . client . get ( '/api/jobs/{0}/result/' . format ( invalid_job_id ) , HTTP_ACCEPT = 'application/json' ) #NEWLINE# content = json . loads ( response . content ) #NEWLINE# self . assertEqual ( len ( content [ 'items' ] ) , 6 )