#NEWLINE# @ override_settings ( ST_NOTIFICATIONS_PER_PAGE = 20 ) #NEWLINE# def test_topic_notification_ajax_order( self ) : #NEWLINE# #INDENT# '\n        order by is_read=False first then by date\n        ' #NEWLINE# user = utils . create_user ( ) #NEWLINE# for _ in range ( 10 ) : #NEWLINE# #INDENT# topic = utils . create_topic ( self . category , user = user ) #NEWLINE# comment = utils . create_comment ( topic = topic , user = user ) #NEWLINE# TopicNotification . objects . create ( user = self . user , topic = topic , comment = comment , is_active = True , action = COMMENT ) #NEWLINE# #UNINDENT# TopicNotification . objects . filter ( user = self . user ) . update ( is_read = True ) #NEWLINE# old_date = ( timezone . now ( ) - datetime . timedelta ( days = 10 ) ) #NEWLINE# TopicNotification . objects . filter ( pk = self . topic_notification . pk ) . update ( is_read = False , date = old_date ) #NEWLINE# utils . login ( self ) #NEWLINE# response = self . client . get ( reverse ( 'spirit:topic:notification:index-ajax' ) , HTTP_X_REQUESTED_WITH = 'XMLHttpRequest' ) #NEWLINE# res = json . loads ( response . content . decode ( 'utf-8' ) ) #NEWLINE# self . assertFalse ( res [ 'n' ] [ 0 ] [ 'is_read' ] ) #NEWLINE# self . assertTrue ( res [ 'n' ] [ 1 ] [ 'is_read' ] )