Ticket #11675: test.diff

File test.diff, 1.4 KB (added by Jeff Ammons, 15 years ago)

Test for our proposed fix

  • tests/regressiontests/cache/tests.py

     
    33# Unit tests for cache framework
    44# Uses whatever cache backend is set in the test settings file.
    55
     6import sys
    67import os
    78import shutil
    89import tempfile
     
    1112
    1213from django.conf import settings
    1314from django.core import management
    14 from django.core.cache import get_cache
     15from django.core.cache import get_cache, parse_backend_uri
    1516from django.core.cache.backends.base import InvalidCacheBackendError
    1617from django.http import HttpResponse, HttpRequest
    1718from django.utils.cache import patch_vary_headers, get_cache_key, learn_cache_key
     
    347348        def setUp(self):
    348349            self.cache = get_cache(settings.CACHE_BACKEND)
    349350
     351        def test_memcache_module_import(self):
     352            """
     353            Test that the proper module (i.e. cmemcache or memcache) is
     354            being imported.
     355            """
     356            scheme, host, params = parse_backend_uri(settings.CACHE_BACKEND)
     357            if 'lib' in params:
     358                lib = params['lib']
     359                self.assertTrue(sys.modules.has_key(lib))
     360
     361
    350362class FileBasedCacheTests(unittest.TestCase, BaseCacheTests):
    351363    """
    352364    Specific test cases for the file-based cache.
Back to Top