#NEWLINE# def test_on_patch_ok_with_some_fields( self ) : #NEWLINE# #INDENT# new_version = random . randint ( 0 , 99 ) #NEWLINE# self . mock_db . update_job . return_value = new_version #NEWLINE# patch_doc = { #NEWLINE# #INDENT# 'some_field' : 'some_value' , #NEWLINE# 'because' : 'size_matters' , #NEWLINE# 'job_schedule' : { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } #NEWLINE# self . mock_req . stream . read . return_value = json . dumps ( patch_doc ) #NEWLINE# expected_result = { #NEWLINE# #INDENT# 'job_id' : fake_job_0_job_id , #NEWLINE# 'version' : self , #NEWLINE# #UNINDENT# } #NEWLINE# self . resource . update_actions_in_job = Mock ( ) #NEWLINE# self . resource . on_patch ( self . mock_req , self . mock_req , fake_job_0_job_id ) #NEWLINE# self . mock_db . update_job . assert_called_with ( user_id = fake_job_0_user_id , job_id = fake_job_0_job_id , patch_doc = patch_doc ) #NEWLINE# self . assertEqual ( self . mock_req . status , falcon . HTTP_200 ) #NEWLINE# result = self . mock_req . body #NEWLINE# self . assertEqual ( result , expected_result )