コード例 #1
0
class CeleryIsolatedClientTest(TestCase):
    def setUp(self):
        self.client = CeleryClient(
            servers=['http://example.com'],
            public_key='public',
            secret_key='secret',
        )

    @mock.patch('raven.contrib.django.celery.send_raw')
    def test_send_encoded(self, send_raw):
        self.client.send_encoded('foo')

        send_raw.delay.assert_called_once_with('foo')

    @mock.patch('raven.contrib.django.celery.send_raw')
    def test_without_eager(self, send_raw):
        """
        Integration test to ensure it propagates all the way down
        and calls delay on the task.
        """
        self.client.captureMessage(message='test')

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

    @with_eager_tasks
    @mock.patch('raven.contrib.django.DjangoClient.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.
        """
        self.client.captureMessage(message='test')

        self.assertEquals(send_encoded.call_count, 1)
コード例 #2
0
ファイル: tests.py プロジェクト: sharoonthomas/raven
class CeleryIsolatedClientTest(TestCase):
    def setUp(self):
        self.client = CeleryClient(servers=["http://example.com"], public_key="public", secret_key="secret")

    @mock.patch("raven.contrib.django.celery.CeleryClient.send_raw")
    def test_send_encoded(self, send_raw):
        self.client.send_encoded("foo")

        send_raw.delay.assert_called_once_with("foo")

    @mock.patch("raven.contrib.django.celery.CeleryClient.send_raw")
    def test_without_eager(self, send_raw):
        """
        Integration test to ensure it propagates all the way down
        and calls delay on the task.
        """
        self.client.capture("Message", message="test")

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

    @with_eager_tasks
    @mock.patch("raven.contrib.django.DjangoClient.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.
        """
        self.client.capture("Message", message="test")

        self.assertEquals(send_encoded.call_count, 1)
コード例 #3
0
ファイル: tests.py プロジェクト: hopecream/raven-python
class CeleryIsolatedClientTest(TestCase):
    def setUp(self):
        self.client = CeleryClient(
            servers=['http://example.com'],
            public_key='public',
            secret_key='secret',
        )

    @mock.patch('raven.contrib.django.celery.send_raw')
    def test_send_encoded(self, send_raw):
        self.client.send_encoded('foo')

        send_raw.delay.assert_called_once_with('foo')

    @mock.patch('raven.contrib.django.celery.send_raw')
    def test_without_eager(self, send_raw):
        """
        Integration test to ensure it propagates all the way down
        and calls delay on the task.
        """
        self.client.captureMessage(message='test')

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

    @with_eager_tasks
    @mock.patch('raven.contrib.django.DjangoClient.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.
        """
        self.client.captureMessage(message='test')

        self.assertEquals(send_encoded.call_count, 1)
コード例 #4
0
ファイル: tests.py プロジェクト: recht/raven-python
class CeleryIsolatedClientTest(TestCase):
    def setUp(self):
        self.client = CeleryClient(dsn="sync+http://public:[email protected]/1")

    @mock.patch("raven.contrib.django.celery.send_raw")
    def test_send_encoded(self, send_raw):
        self.client.send_encoded("foo")

        send_raw.delay.assert_called_once_with("foo")

    @mock.patch("raven.contrib.django.celery.send_raw")
    def test_without_eager(self, send_raw):
        """
        Integration test to ensure it propagates all the way down
        and calls delay on the task.
        """
        self.client.captureMessage(message="test")

        assert send_raw.delay.call_count == 1
コード例 #5
0
class CeleryIsolatedClientTest(TestCase):
    def setUp(self):
        self.client = CeleryClient(
            dsn='sync+http://public:[email protected]/1')

    @mock.patch('raven.contrib.django.celery.send_raw')
    def test_send_encoded(self, send_raw):
        self.client.send_encoded('foo')

        send_raw.delay.assert_called_once_with('foo')

    @mock.patch('raven.contrib.django.celery.send_raw')
    def test_without_eager(self, send_raw):
        """
        Integration test to ensure it propagates all the way down
        and calls delay on the task.
        """
        self.client.captureMessage(message='test')

        assert send_raw.delay.call_count == 1