Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
D
Django-Redis-Cache
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Shared
Django-Redis-Cache
Commits
753a1a1c
Commit
753a1a1c
authored
Jun 29, 2015
by
Sean Bleier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added test that should error in python3.
parent
ab989e8a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
0 deletions
+34
-0
base_tests.py
tests/testapp/tests/base_tests.py
+34
-0
No files found.
tests/testapp/tests/base_tests.py
View file @
753a1a1c
...
...
@@ -8,6 +8,12 @@ try:
except
ImportError
:
import
pickle
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
...
...
@@ -16,6 +22,9 @@ from redis_cache.cache import RedisCache, pool
from
redis_cache.compat
import
DEFAULT_TIMEOUT
LOCATION
=
"127.0.0.1:6381"
# functions/classes for complex data type tests
def
f
():
return
42
...
...
@@ -493,3 +502,28 @@ class BaseRedisTestCase(SetupMixin):
self
.
cache
.
expire
(
'a'
,
20
)
ttl
=
self
.
cache
.
ttl
(
'a'
)
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'
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment