#NEWLINE# def _test_update_by_id( self , key , response_value , response_body , attrs , json_body , response_headers = None ) : #NEWLINE# #INDENT# class FakeResource2 ( FakeResource ) : #NEWLINE# #INDENT# patch_update = True #NEWLINE# resource_key = key #NEWLINE# service = 'my_service' #NEWLINE# #UNINDENT# response = mock . Mock ( ) #NEWLINE# response . json = mock . Mock ( return_value = response_body ) #NEWLINE# response . headers = response_headers #NEWLINE# expected_resp = response_value . copy ( ) #NEWLINE# if response_headers : #NEWLINE# #INDENT# expected_resp . update ( { #NEWLINE# #INDENT# 'headers' : response_headers , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# sess = mock . Mock ( ) #NEWLINE# sess . patch = mock . Mock ( return_value = response ) #NEWLINE# r_id = 'my_id' #NEWLINE# resp = FakeResource2 . update_by_id ( sess , r_id , attrs ) #NEWLINE# self . assertEqual ( expected_resp , resp ) #NEWLINE# sess . patch . assert_called_with ( utils . urljoin ( FakeResource2 . base_path , r_id ) , endpoint_filter = FakeResource2 . service , json = json_body ) #NEWLINE# path_args = { #NEWLINE# #INDENT# 'parent_name' : 'my_name' , #NEWLINE# #UNINDENT# } #NEWLINE# resp = FakeResource2 . update_by_id ( sess , r_id , attrs , path_args = path_args ) #NEWLINE# self . assertEqual ( expected_resp , resp ) #NEWLINE# sess . patch . assert_called_with ( utils . urljoin ( ( FakeResource2 . base_path % path_args ) , r_id ) , endpoint_filter = FakeResource2 . service , json = json_body )