#NEWLINE# def test_group_notifications_by_user_transactional( self ) : #NEWLINE# #INDENT# send_type = 'email_transactional' #NEWLINE# d = factories . NotificationDigestFactory ( user_id = self . user_1 . _id , send_type = send_type , timestamp = self . timestamp , message = 'Hello' , node_lineage = [ self . project . _id ] ) #NEWLINE# d . save ( ) #NEWLINE# d2 = factories . NotificationDigestFactory ( user_id = self . user_2 . _id , send_type = send_type , timestamp = self . timestamp , message = 'Hello' , node_lineage = [ self . project . _id ] ) #NEWLINE# d2 . save ( ) #NEWLINE# d3 = factories . NotificationDigestFactory ( user_id = self . user_2 . _id , send_type = 'email_digest' , timestamp = self . timestamp , message = 'Hello, but this should not appear (this is a digest)' , node_lineage = [ self . project . _id ] ) #NEWLINE# d3 . save ( ) #NEWLINE# user_groups = get_users_emails ( send_type ) #NEWLINE# expected = [ { #NEWLINE# #INDENT# 'user_id' : self . user_1 . _id , #NEWLINE# 'info' : [ { #NEWLINE# #INDENT# 'message' : 'Hello' , #NEWLINE# 'node_lineage' : [ unicode ( self . project . _id ) ] , #NEWLINE# '_id' : d . _id , #NEWLINE# #UNINDENT# } ] , #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# 'user_id' : self . user_2 . _id , #NEWLINE# 'info' : [ { #NEWLINE# #INDENT# 'message' : 'Hello' , #NEWLINE# 'node_lineage' : [ unicode ( self . project . _id ) ] , #NEWLINE# '_id' : d2 . _id , #NEWLINE# #UNINDENT# } ] , #NEWLINE# #UNINDENT# } ] #NEWLINE# assert_equal ( len ( user_groups ) , 2 ) #NEWLINE# assert_equal ( user_groups , expected ) #NEWLINE# digest_ids = [ d . _id , d2 . _id , d3 . _id ] #NEWLINE# remove_notifications ( email_notification_ids = digest_ids )