#NEWLINE# def test_model_signals( self ) : #NEWLINE# #INDENT# recorded = [ ] #NEWLINE# def committed( sender , changes ) : #NEWLINE# #INDENT# self . assertTrue ( isinstance ( changes , list ) ) #NEWLINE# recorded . extend ( changes ) #NEWLINE# #UNINDENT# fsa . models_committed . connect ( committed ) #NEWLINE# todo = self . Todo ( 'Awesome' , 'the text' ) #NEWLINE# self . db . session . add ( todo ) #NEWLINE# self . assertEqual ( len ( recorded ) , 0 ) #NEWLINE# self . db . session . commit ( ) #NEWLINE# self . assertEqual ( len ( recorded ) , 1 ) #NEWLINE# self . assertEqual ( recorded [ 0 ] [ 0 ] , todo ) #NEWLINE# self . assertEqual ( recorded [ 0 ] [ 1 ] , 'insert' ) #NEWLINE# del recorded [ : ] #NEWLINE# todo . text = 'aha' #NEWLINE# self . db . session . commit ( ) #NEWLINE# self . assertEqual ( len ( recorded ) , 1 ) #NEWLINE# self . assertEqual ( recorded [ 0 ] [ 0 ] , todo ) #NEWLINE# self . assertEqual ( recorded [ 0 ] [ 1 ] , 'update' ) #NEWLINE# del recorded [ : ] #NEWLINE# self . db . session . delete ( todo ) #NEWLINE# self . db . session . commit ( ) #NEWLINE# self . assertEqual ( len ( recorded ) , 1 ) #NEWLINE# self . assertEqual ( recorded [ 0 ] [ 0 ] , todo ) #NEWLINE# self . assertEqual ( recorded [ 0 ] [ 1 ] , 'delete' ) #NEWLINE# fsa . models_committed . disconnect ( committed )