testutils.py 476 B

123456789101112131415161718192021
  1. from django.test import TestCase
  2. from . import threadstore
  3. from .cache import cache
  4. class MisagoTestCase(TestCase):
  5. """
  6. TestCase class that empties global state before and after each test
  7. """
  8. def clear_state(self):
  9. cache.clear()
  10. threadstore.clear()
  11. def setUp(self):
  12. super(MisagoTestCase, self).setUp()
  13. self.clear_state()
  14. def tearDown(self):
  15. self.clear_state()
  16. super(MisagoTestCase, self).tearDown()