Ticket #15863: django_cache_simplecookie_test_failures.diff

File django_cache_simplecookie_test_failures.diff, 954 bytes (added by Raphael Kubo da Costa, 14 years ago)

Testcase referenced in the bug description.

  • tests/regressiontests/cache/tests.py

    diff --git a/tests/regressiontests/cache/tests.py b/tests/regressiontests/cache/tests.py
    index 0581e4e..5611eef 100644
    a b class BaseCacheTests(object):  
    285285        self.assertEqual(self.cache.get("expire2"), "newvalue")
    286286        self.assertEqual(self.cache.has_key("expire3"), False)
    287287
     288    def test_cookie_caching(self):
     289        try:
     290            from Cookie import SimpleCookie
     291        except ImportError:
     292            from http.cookies import SimpleCookie
     293
     294        test_cookie = SimpleCookie()
     295        test_cookie['key'] = 'some value'
     296
     297        self.cache.set('some_cookie', test_cookie)
     298
     299        cached_cookie = self.cache.get('some_cookie')
     300
     301        self.assertEqual(cached_cookie['key'].value,
     302                         test_cookie['key'].value)
     303
    288304    def test_unicode(self):
    289305        # Unicode values can be cached
    290306        stuff = {
Back to Top