#NEWLINE# def test_should_not_try_to_update_fields_that_are_not_in_model( self ) : #NEWLINE# #INDENT# data = { #NEWLINE# #INDENT# 'title' : 'goodbye' , #NEWLINE# 'not_existing_field' : 'moon' , #NEWLINE# #UNINDENT# } #NEWLINE# serializer = CommentSerializer ( instance = self . get_comment ( ) , data = data , partial = True ) #NEWLINE# self . assertTrue ( serializer . is_valid ( ) ) #NEWLINE# try : #NEWLINE# #INDENT# serializer . save ( ) #NEWLINE# #UNINDENT# except ValueError : #NEWLINE# #INDENT# msg = 'Should not pass values to update_fields from data, if they are not in model' #NEWLINE# self . fail ( msg ) #NEWLINE# #UNINDENT# fresh_instance = self . get_comment ( ) #NEWLINE# self . assertEqual ( fresh_instance . title , 'goodbye' ) #NEWLINE# self . assertEqual ( fresh_instance . text , 'world' )