#NEWLINE# def test_save_entry_level_task_assignment( self ) : #NEWLINE# #INDENT# response = self . clients [ 0 ] . get ( '/orchestra/api/interface/new_task_assignment/entry_level/' ) #NEWLINE# self . assertEquals ( response . status_code , 200 ) #NEWLINE# returned = json . loads ( response . content . decode ( 'utf-8' ) ) #NEWLINE# task = Task . objects . get ( id = returned [ 'id' ] ) #NEWLINE# response = self . clients [ 0 ] . post ( '/orchestra/api/interface/save_task_assignment/' , json . dumps ( { #NEWLINE# #INDENT# 'task_id' : ( - 1 ) , #NEWLINE# 'task_data' : 'test' , #NEWLINE# #UNINDENT# } ) , content_type = 'application/json' ) #NEWLINE# self . assertEquals ( response . status_code , 400 ) #NEWLINE# returned = json . loads ( response . content . decode ( 'utf-8' ) ) #NEWLINE# self . assertEquals ( returned [ 'message' ] , 'No task for given id' ) #NEWLINE# response = self . clients [ 1 ] . post ( '/orchestra/api/interface/save_task_assignment/' , json . dumps ( { #NEWLINE# #INDENT# 'task_id' : task . id , #NEWLINE# 'task_data' : 'test' , #NEWLINE# #UNINDENT# } ) , content_type = 'application/json' ) #NEWLINE# self . assertEquals ( response . status_code , 400 ) #NEWLINE# returned = json . loads ( response . content . decode ( 'utf-8' ) ) #NEWLINE# self . assertEquals ( returned [ 'message' ] , 'Worker is not associated with task' ) #NEWLINE# new_data = { #NEWLINE# #INDENT# 'new_test_key' : 'new_test_value' , #NEWLINE# #UNINDENT# } #NEWLINE# response = self . clients [ 0 ] . post ( '/orchestra/api/interface/save_task_assignment/' , json . dumps ( { #NEWLINE# #INDENT# 'task_id' : task . id , #NEWLINE# 'task_data' : new_data , #NEWLINE# #UNINDENT# } ) , content_type = 'application/json' ) #NEWLINE# self . assertEquals ( response . status_code , 200 ) #NEWLINE# self . _verify_good_task_assignment_information ( self . clients [ 0 ] , { #NEWLINE# #INDENT# 'task_id' : task . id , #NEWLINE# #UNINDENT# } , task . project . short_description , 'Processing' , 'Processing' , False , False , new_data , self . workers [ 0 ] )