#NEWLINE# @ patch . object ( forms , 'Thread' ) #NEWLINE# def test_save_confirm_is_false_threads_not_updated( self , mock_thread ) : #NEWLINE# #INDENT# 'Thread should not be updated is confirm is False.' #NEWLINE# self . assertFalse ( self . banned_user . is_banned ) #NEWLINE# form = forms . BanUserForm ( { #NEWLINE# #INDENT# 'user' : self . banned_user . pk , #NEWLINE# 'confirm' : False , #NEWLINE# #UNINDENT# } ) #NEWLINE# self . assertTrue ( form . is_valid ( ) ) #NEWLINE# form . save ( ) #NEWLINE# self . assertEqual ( mock_thread . objects . filter . call_count , 0 ) #NEWLINE# form = forms . BanUserForm ( { #NEWLINE# #INDENT# 'user' : self . banned_user . pk , #NEWLINE# 'confirm' : True , #NEWLINE# #UNINDENT# } ) #NEWLINE# self . assertTrue ( form . is_valid ( ) ) #NEWLINE# form . save ( ) #NEWLINE# self . assertEqual ( mock_thread . objects . filter . call_count , 1 )