django-defender/defender/test.py
Aleksi Häkli a1d526f318
PEP8 formatting (#147)
Run black with Python 2.7 as target version
to unify the code styling and make it more
linter and style guide compliant
2019-11-15 20:22:14 +02:00

24 lines
685 B
Python

from django.test.testcases import TestCase, TransactionTestCase
from .connection import get_redis_connection
class DefenderTestCaseMixin(object):
"""Mixin used to provide a common tearDown method"""
def tearDown(self):
"""cleanup django-defender cache after each test"""
super(DefenderTestCaseMixin, self).tearDown()
get_redis_connection().flushdb()
class DefenderTransactionTestCase(DefenderTestCaseMixin, TransactionTestCase):
"""Helper TransactionTestCase that cleans the cache after each test"""
pass
class DefenderTestCase(DefenderTestCaseMixin, TestCase):
"""Helper TestCase that cleans the cache after each test"""
pass