def test_post_user_notification(self):
     u = M.User.query.get(username='******')
     n = M.Notification.post_user(u, self.pg, 'metadata')
     ThreadLocalORMSession.flush_all()
     ThreadLocalORMSession.close_all()
     flash_msgs = list(h.pop_user_notifications(u))
     assert len(flash_msgs) == 1, flash_msgs
     msg = flash_msgs[0]
     assert msg['text'].startswith('Home modified by Test Admin')
     assert msg['subject'].startswith('[test:wiki]')
     flash_msgs = list(h.pop_user_notifications(u))
     assert not flash_msgs, flash_msgs
 def test_post_user_notification(self):
     u = M.User.query.get(username='******')
     M.Notification.post_user(u, self.pg, 'metadata')
     ThreadLocalORMSession.flush_all()
     ThreadLocalORMSession.close_all()
     flash_msgs = list(h.pop_user_notifications(u))
     assert len(flash_msgs) == 1, flash_msgs
     msg = flash_msgs[0]
     assert msg['text'].startswith('Home modified by Test Admin')
     assert msg['subject'].startswith('[test:wiki]')
     flash_msgs = list(h.pop_user_notifications(u))
     assert not flash_msgs, flash_msgs