#NEWLINE# def test_dispatch_action( self ) : #NEWLINE# #INDENT# from .. models import follow , unfollow #NEWLINE# from . sequere_registry import JoinAction , LikeAction , Project #NEWLINE# from sequere.contrib.timeline import Timeline #NEWLINE# follow ( self . newbie , self . user ) #NEWLINE# timeline = Timeline ( self . user ) #NEWLINE# action = JoinAction ( self . user ) #NEWLINE# timeline . save ( action ) #NEWLINE# timeline = Timeline ( self . newbie ) #NEWLINE# self . assertEqual ( timeline . get_private_count ( ) , 1 ) #NEWLINE# self . assertEqual ( timeline . get_public_count ( ) , 0 ) #NEWLINE# unfollow ( self . newbie , self . user ) #NEWLINE# action = LikeAction ( actor = self . user , target = timeline . project ) #NEWLINE# timeline = Timeline ( self . user ) #NEWLINE# timeline . save ( action ) #NEWLINE# self . assertEqual ( timeline . get_private_count ( ) , 2 ) #NEWLINE# self . assertEqual ( timeline . get_public_count ( ) , 2 ) #NEWLINE# self . assertEqual ( timeline . get_private_count ( target = Project ) , 1 ) #NEWLINE# self . assertEqual ( timeline . get_public_count ( target = Project ) , 1 ) #NEWLINE# timeline = Timeline ( self . newbie ) #NEWLINE# self . assertEqual ( timeline . get_private_count ( ) , 0 ) #NEWLINE# self . assertEqual ( timeline . get_unread_count ( ) , 0 ) #NEWLINE# timeline . mark_as_read ( timestamp = ( datetime . now ( ) + timedelta ( days = 1 ) ) ) #NEWLINE# self . assertEqual ( timeline . get_unread_count ( ) , 0 ) #NEWLINE# self . assertEqual ( timeline . get_public_count ( ) , 0 )