#NEWLINE# @ mock . patch . object ( Site . objects , 'get_current' ) #NEWLINE# def test_autowatch_new_thread( self , get_current ) : #NEWLINE# #INDENT# 'Creating a new thread should email responses' #NEWLINE# get_current . return_value . domain = 'testserver' #NEWLINE# f = ForumFactory ( ) #NEWLINE# u = UserFactory ( ) #NEWLINE# self . client . login ( username = u . username , password = 'testpass' ) #NEWLINE# s = Setting . objects . create ( user = u , name = 'forums_watch_new_thread' , value = 'False' ) #NEWLINE# data = { #NEWLINE# #INDENT# 'title' : 'a title' , #NEWLINE# 'content' : 'a post' , #NEWLINE# #UNINDENT# } #NEWLINE# post ( self . client , 'forums.new_thread' , data , args = [ f . slug ] ) #NEWLINE# t1 = Thread . objects . all ( ) . order_by ( '-id' ) [ 0 ] #NEWLINE# assert ( not NewPostEvent . is_notifying ( u , t1 ) ) , 'NewPostEvent should not be notifying.' #NEWLINE# s . value = 'True' #NEWLINE# s . save ( ) #NEWLINE# post ( self . client , 'forums.new_thread' , data , args = [ f . slug ] ) #NEWLINE# t2 = Thread . objects . all ( ) . order_by ( '-id' ) [ 0 ] #NEWLINE# assert NewPostEvent . is_notifying ( u , t2 ) , 'NewPostEvent should be notifying.'