Skip to content

Commit

Permalink
Make celery mixin tests work with celery 3.1
Browse files Browse the repository at this point in the history
It's ugly but should be backwards compatible to Celery 2.5
  • Loading branch information
dctrwatson committed Dec 5, 2013
1 parent 04b8cd7 commit a3a68a7
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions tests/contrib/celery/tests.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# -*- coding: utf-8 -*-

import mock

from celery.app import app_or_default

from raven.utils.testutils import TestCase
from celery.tests.utils import with_eager_tasks
from raven.contrib.celery import CeleryClient


Expand All @@ -26,13 +28,17 @@ def test_without_eager(self, send_raw):

self.assertEquals(send_raw.delay.call_count, 1)

@with_eager_tasks
@mock.patch('raven.base.Client.send_encoded')
def test_with_eager(self, send_encoded):
"""
Integration test to ensure it propagates all the way down
and calls the parent client's send_encoded method.
"""
celery_app = app_or_default()
celery_app.conf.CELERY_ALWAYS_EAGER = True

self.client.captureMessage(message='test')

self.assertEquals(send_encoded.call_count, 1)

celery_app.conf.CELERY_ALWAYS_EAGER = False

0 comments on commit a3a68a7

Please sign in to comment.