#NEWLINE# def test_kill_tasks_passes_catches_fewer_than_error( ) : #NEWLINE# #INDENT# fake_client = mock . Mock ( ) #NEWLINE# bad_fake_response = mock . Mock ( ) #NEWLINE# bad_fake_response . status_code = 422 #NEWLINE# bad_fake_response . json . return_value = { #NEWLINE# #INDENT# 'message' : 'Bean is not valid' , #NEWLINE# 'errors' : [ { #NEWLINE# #INDENT# 'attribute' : 'instances' , #NEWLINE# 'error' : 'must be greater than or equal to 0' , #NEWLINE# #UNINDENT# } ] , #NEWLINE# #UNINDENT# } #NEWLINE# fake_client . kill_task . side_effect = MarathonHttpError ( response = bad_fake_response ) #NEWLINE# actual = marathon_tools . kill_task ( client = fake_client , app_id = 'app_id' , task_id = 'task_id' , scale = True ) #NEWLINE# fake_client . kill_task . assert_called_once_with ( scale = True , task_id = 'task_id' , app_id = 'app_id' ) #NEWLINE# assert ( actual == [ ] )