summaryrefslogtreecommitdiff
path: root/tests/regressiontests/cache
diff options
context:
space:
mode:
authorMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2007-10-20 15:16:34 +0000
committerMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2007-10-20 15:16:34 +0000
commit714c09b8bdba069d2de49c5cf58f500497711f85 (patch)
treeb606bb82053ce9ead52abcb2ba491d1a0622a506 /tests/regressiontests/cache
parentb678601df302307f0e1fed9b5354765a3b238481 (diff)
Fixed #4831 -- Added an "add" cache key method, for parity with memcached's
API. This works for all cache backends. Patch from Matt McClanahan. git-svn-id: http://code.djangoproject.com/svn/django/trunk@6572 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests/regressiontests/cache')
-rw-r--r--tests/regressiontests/cache/tests.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/regressiontests/cache/tests.py b/tests/regressiontests/cache/tests.py
index 752083bd2f..3879da7703 100644
--- a/tests/regressiontests/cache/tests.py
+++ b/tests/regressiontests/cache/tests.py
@@ -19,6 +19,12 @@ class Cache(unittest.TestCase):
cache.set("key", "value")
self.assertEqual(cache.get("key"), "value")
+ def test_add(self):
+ # test add (only add if key isn't already in cache)
+ cache.add("addkey1", "value")
+ cache.add("addkey1", "newvalue")
+ self.assertEqual(cache.get("addkey1"), "value")
+
def test_non_existent(self):
# get with non-existent keys
self.assertEqual(cache.get("does_not_exist"), None)