#NEWLINE# def test_reversion_history_save( self ) : #NEWLINE# #INDENT# response = self . client . post ( '/test-ralph-api/foos/' , data = { #NEWLINE# #INDENT# 'bar' : 'bar_name' , #NEWLINE# #UNINDENT# } ) #NEWLINE# foo = Foo . objects . get ( pk = response . data [ 'id' ] ) #NEWLINE# history = reversion . get_for_object ( foo ) #NEWLINE# self . assertEqual ( len ( history ) , 1 ) #NEWLINE# self . assertIn ( 'bar_name' , history [ 0 ] . serialized_data ) #NEWLINE# response = self . client . patch ( '/test-ralph-api/foos/{}/' . format ( foo . id ) , data = { #NEWLINE# #INDENT# 'bar' : 'new_bar' , #NEWLINE# #UNINDENT# } ) #NEWLINE# foo = Foo . objects . get ( pk = response . data [ 'id' ] ) #NEWLINE# history = reversion . get_for_object ( foo ) #NEWLINE# self . assertEqual ( len ( self ) , 2 ) #NEWLINE# self . assertIn ( 'new_bar' , history [ 0 ] . serialized_data )