mirror of
https://github.com/Hopiu/django-cachalot.git
synced 2026-05-09 13:14:44 +00:00
Revert "Tests the settings overrider on classes."
This reverts commit 03302ff23a.
This commit is contained in:
parent
03302ff23a
commit
bdd112e2fd
2 changed files with 7 additions and 24 deletions
|
|
@ -71,14 +71,6 @@ or simply by changing its attributes:
|
|||
# Globally disables SQL caching until you set it back to True
|
||||
cachalot_settings.CACHALOT_ENABLED = False
|
||||
|
||||
from django.test import TestCase
|
||||
|
||||
@cachalot_settings(CACHALOT_ENABLED=True)
|
||||
class YourTestCase(TestCase):
|
||||
# SQL caching is enabled again in every method of this test
|
||||
|
||||
# SQL caching is disabled again because we globally disabled it
|
||||
|
||||
In tests, you can use
|
||||
`Django’s testing tools <https://docs.djangoproject.com/en/1.7/topics/testing/tools/#overriding-settings>`_
|
||||
as well as ``cachalot_settings``. They will both work the same.
|
||||
|
|
|
|||
|
|
@ -1181,23 +1181,14 @@ class AtomicTestCase(TestCase):
|
|||
self.assertListEqual(data3, [t1])
|
||||
|
||||
|
||||
@cachalot_settings(CACHALOT_ENABLED=False)
|
||||
class SettingsDecoratorTestCase(TestCase):
|
||||
def test_class(self):
|
||||
with self.assertNumQueries(1):
|
||||
list(Test.objects.all())
|
||||
with self.assertNumQueries(1):
|
||||
list(Test.objects.all())
|
||||
|
||||
@cachalot_settings(CACHALOT_ENABLED=True)
|
||||
def test_method(self):
|
||||
with self.assertNumQueries(1):
|
||||
list(Test.objects.all())
|
||||
with self.assertNumQueries(0):
|
||||
list(Test.objects.all())
|
||||
|
||||
|
||||
class SettingsTestCase(TestCase):
|
||||
@cachalot_settings(CACHALOT_ENABLED=False)
|
||||
def test_decorator(self):
|
||||
with self.assertNumQueries(1):
|
||||
list(Test.objects.all())
|
||||
with self.assertNumQueries(1):
|
||||
list(Test.objects.all())
|
||||
|
||||
def test_enabled(self):
|
||||
with cachalot_settings(CACHALOT_ENABLED=True):
|
||||
with self.assertNumQueries(1):
|
||||
|
|
|
|||
Loading…
Reference in a new issue