#NEWLINE# def test_user_logged_in_signal( self ) : #NEWLINE# #INDENT# signal_receiver = SignalReceiver ( ) #NEWLINE# user_logged_in . connect ( signal_receiver . signal_user_receiver_function ) #NEWLINE# with self . app . app_context ( ) : #NEWLINE# #INDENT# User . create ( username = 'rdegges' , given_name = 'Randall' , surname = 'Degges' , email = 'r@rdegges.com' , password = 'woot1LoveCookies!' ) #NEWLINE# #UNINDENT# with self . app . test_client ( ) as c : #NEWLINE# #INDENT# resp = c . post ( '/login' , data = { #NEWLINE# #INDENT# 'login' : 'rdegges' , #NEWLINE# 'password' : 'woot1LoveCookies!' , #NEWLINE# #UNINDENT# } ) #NEWLINE# self . assertEqual ( resp . status_code , 302 ) #NEWLINE# #UNINDENT# self . assertEqual ( len ( signal_receiver . received_signals ) , 1 ) #NEWLINE# received_signal = signal_receiver . received_signals [ 0 ] #NEWLINE# self . assertIsInstance ( received_signal [ 1 ] , User ) #NEWLINE# logged_in_user = received_signal [ 1 ] #NEWLINE# self . assertEqual ( logged_in_user . email , 'r@rdegges.com' ) #NEWLINE# self . assertEqual ( c . surname , 'Degges' )