Permalink
Browse files

turn off django paranoia for tests (bug 822760)

  • Loading branch information...
1 parent a58bed2 commit 084d22584cdb3b6c60002e2cebb9eec7f92a1337 @andymckay andymckay committed Dec 21, 2012
Showing with 20 additions and 11 deletions.
  1. +6 −4 lib/buyers/tests/test_api.py
  2. +5 −7 manage.py
  3. +3 −0 settings_test.py
  4. +6 −0 solitude/settings/base.py
@@ -1,5 +1,6 @@
import json
+from django_paranoia.signals import warning
import mock
from nose.tools import eq_
@@ -120,13 +121,14 @@ def test_patch_same_uuid(self):
eq_(res.status_code, 202)
eq_(obj.reget().uuid, self.uuid)
- @mock.patch('django_paranoia.reporters.cef_.log_cef')
- def test_paranoid_pin(self, log_cef):
- # A test of the paranoid form.
+ def test_paranoid_pin(self):
+ mthd = mock.Mock()
+ mthd.__name__ = 'mock_signal'
+ warning.connect(mthd, weak=False)
self.client.post(self.list_url, data={'uuid': self.uuid,
'pin': self.pin,
'foo': 'something naughty'})
- assert log_cef.called
+ assert mthd.called
class TestBuyerPaypal(APITest):
View
@@ -23,13 +23,11 @@
manage.setup_environ(__file__, more_pythonic=True)
-# This isn't great, but it's evolving. Will move around hopefully.
-from django_paranoia import configure
-configure.config([
- 'django_paranoia.reporters.log',
- 'django_paranoia.reporters.cef_'
-])
-
if __name__ == "__main__":
manage.main()
+
+ # This isn't great, but it's evolving. Will move around hopefully.
+ from django.conf import settings
+ from django_paranoia import configure
+ configure.config(settings.DJANGO_PARANOIA_REPORTERS)
View
@@ -34,3 +34,6 @@
# Send all statsd to nose.
STATSD_CLIENT = 'django_statsd.clients.nose'
+
+# No need for paranoia in tests.
+DJANGO_PARANOIA_REPORTERS = []
@@ -180,3 +180,9 @@
CELERY_IMPORTS = ('lib.delayable.tasks',)
CELERY_RESULT_BACKEND = 'database'
CELERYD_HIJACK_ROOT_LOGGER = False
+
+# Paranoia levels.
+DJANGO_PARANOIA_REPORTERS = [
+ 'django_paranoia.reporters.log',
+ 'django_paranoia.reporters.cef_'
+]

0 comments on commit 084d225

Please sign in to comment.