#NEWLINE# def test_marks_unread( self ) : #NEWLINE# #INDENT# 'Test that sending a message to a group marks the thread as unread.' #NEWLINE# group = self . create_group ( ) #NEWLINE# user1 = self . create_user ( ) #NEWLINE# user2 = self . create_user ( ) #NEWLINE# user1 . add_to_group ( group . pk ) #NEWLINE# user2 . add_to_group ( group . pk ) #NEWLINE# thread = self . create_thread ( group = group , create_recipient = False ) #NEWLINE# send_message ( thread . first_message . pk ) #NEWLINE# thread . userthread_set . update ( read = True ) #NEWLINE# self . assertTrue ( thread . userthread_set . filter ( read = True , user = user1 ) . exists ( ) ) #NEWLINE# self . assertTrue ( thread . userthread_set . filter ( read = True , user = user2 ) . exists ( ) ) #NEWLINE# newmessage = mommy . make ( Message , thread = thread , sender = thread ) #NEWLINE# send_message ( newmessage . pk ) #NEWLINE# self . assertTrue ( thread . userthread_set . filter ( read = True , user = user1 ) . exists ( ) ) #NEWLINE# self . assertTrue ( thread . userthread_set . filter ( read = False , user = user2 ) . exists ( ) )