Skip to content

Commit

Permalink
**really** dont require sentry for tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dcramer committed Sep 3, 2012
1 parent 49a0aaa commit 604b578
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
1 change: 0 additions & 1 deletion runtests.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@

'djcelery', # celery client

'sentry', # server
'raven.contrib.django',
],
ROOT_URLCONF='',
Expand Down
19 changes: 12 additions & 7 deletions tests/contrib/django/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ def __init__(self, *args, **kwargs):
def send(self, **kwargs):
self.events.append(kwargs)

def is_enabled(self, **kwargs):
return True


class Settings(object):
"""
Expand Down Expand Up @@ -86,10 +89,10 @@ class ClientProxyTest(TestCase):
def test_proxy_responds_as_client(self):
self.assertEquals(get_client(), client)

def test_basic(self):
@mock.patch.object(TempStoreClient, 'capture')
def test_basic(self, capture):
client.capture('Message', message='foo')
self.assertEquals(len(client.events), 1)
client.events.pop(0)
capture.assert_called_once_with('Message', message='foo')


class DjangoClientTest(TestCase):
Expand Down Expand Up @@ -486,19 +489,21 @@ def setUp(self):

@mock.patch('raven.contrib.django.celery.send_raw_integrated')
def test_send_encoded(self, send_raw):
self.client.send_integrated('foo')
with Settings(INSTALLED_APPS=tuple(settings.INSTALLED_APPS) + ('sentry',)):
self.client.send_integrated('foo')

send_raw.delay.assert_called_once_with('foo')
send_raw.delay.assert_called_once_with('foo')

@mock.patch('raven.contrib.django.celery.send_raw_integrated')
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')
with Settings(INSTALLED_APPS=tuple(settings.INSTALLED_APPS) + ('sentry',)):
self.client.capture('Message', message='test')

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

@with_eager_tasks
@mock.patch('raven.contrib.django.DjangoClient.send_encoded')
Expand Down

0 comments on commit 604b578

Please sign in to comment.