コード例 #1
0
    def test_notifications(self):
        with app.test_request_context():
            user = get_or_create_super_admin()
            notif = {
                'title': 'Test Notif Title',
                'message': 'Test Notif Message',
                'action': 'Testing Notifications'
            }
            DataManager.create_user_notification(user=user, **notif)

            rv = self.app.get(url_for('profile.notifications_view'))
            self.assertIn(notif['title'], rv.data, msg=rv.data)
            self.assertIn(notif['message'], rv.data, msg=rv.data)
コード例 #2
0
    def test_notification_read(self):
        with app.test_request_context():
            user = get_or_create_super_admin()
            notif = {
                'title': 'Test Notif Title',
                'message': 'Test Notif Message',
                'action': 'Testing Notifications'
            }
            DataManager.create_user_notification(user=user, **notif)

            notification = Notification.query.filter_by(user=user, **notif).first()

            rv = self.app.get(url_for('profile.mark_notification_as_read',
                                      notification_id=notification.id))

            self.assertEqual(notification.has_read, True, msg=rv.data)