Commit 753a1a1c authored by Sean Bleier's avatar Sean Bleier

Added test that should error in python3.

parent ab989e8a
...@@ -8,6 +8,12 @@ try: ...@@ -8,6 +8,12 @@ try:
except ImportError: except ImportError:
import pickle import pickle
from django.core.cache import get_cache from django.core.cache import get_cache
from django.core.exceptions import ImproperlyConfigured
from django.test import TestCase
try:
from django.test import override_settings
except ImportError:
from django.test.utils import override_settings
import redis import redis
...@@ -16,6 +22,9 @@ from redis_cache.cache import RedisCache, pool ...@@ -16,6 +22,9 @@ from redis_cache.cache import RedisCache, pool
from redis_cache.compat import DEFAULT_TIMEOUT from redis_cache.compat import DEFAULT_TIMEOUT
LOCATION = "127.0.0.1:6381"
# functions/classes for complex data type tests # functions/classes for complex data type tests
def f(): def f():
return 42 return 42
...@@ -493,3 +502,28 @@ class BaseRedisTestCase(SetupMixin): ...@@ -493,3 +502,28 @@ class BaseRedisTestCase(SetupMixin):
self.cache.expire('a', 20) self.cache.expire('a', 20)
ttl = self.cache.ttl('a') ttl = self.cache.ttl('a')
self.assertAlmostEqual(ttl, 20) self.assertAlmostEqual(ttl, 20)
class ConfigurationTestCase(SetupMixin, TestCase):
@override_settings(
CACHES={
'default': {
'BACKEND': 'redis_cache.RedisCache',
'LOCATION': LOCATION,
'OPTIONS': {
'DB': 15,
'PASSWORD': 'yadayada',
'PARSER_CLASS': 'path.to.unknown.class',
'PICKLE_VERSION': 2,
'CONNECTION_POOL_CLASS': 'redis.ConnectionPool',
'CONNECTION_POOL_CLASS_KWARGS': {
'max_connections': 2,
}
},
},
}
)
def test_bad_parser_import(self):
with self.assertRaises(ImproperlyConfigured):
get_cache('default')
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment