Ejemplo n.º 1
0
def test_configuration_cache():
    cache.clear()
    shop = get_default_shop()
    configuration.set(None, "key1", "test1")
    configuration.set(shop, "key2", "test2")

    # Shop configurations cache should be bumped
    assert cache.get(configuration._get_cache_key(shop)) is None
    configuration.get(shop, "key1")
    # Now shop configurations and key2 should found from cache
    assert cache.get(configuration._get_cache_key(shop)).get("key2") == "test2"
Ejemplo n.º 2
0
def test_configuration_cache():
    cache.clear()
    shop = get_default_shop()
    configuration.set(None, "key1", "test1")
    configuration.set(shop, "key2", "test2")

    # Shop configurations cache should be bumped
    assert cache.get(configuration._get_cache_key(shop)) is None
    configuration.get(shop, "key1")
    # Now shop configurations and key2 should found from cache
    assert cache.get(configuration._get_cache_key(shop)).get("key2") == "test2"
Ejemplo n.º 3
0
def test_configuration_cache():
    with override_settings(CACHES={
        'default': {
            'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
            'LOCATION': 'test_configuration_cache',
        }
    }):
        cache.init_cache()

        shop = get_default_shop()
        configuration.set(None, "key1", "test1")
        configuration.set(shop, "key2", "test2")

        # Shop configurations cache should be bumped
        assert cache.get(configuration._get_cache_key(shop)) is None
        configuration.get(shop, "key1")
        # Now shop configurations and key2 should found from cache
        assert cache.get(configuration._get_cache_key(shop)).get("key2") == "test2"
Ejemplo n.º 4
0
def test_configuration_cache():
    with override_settings(CACHES={
        'default': {
            'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
            'LOCATION': 'test_configuration_cache',
        }
    }):
        cache.init_cache()

        shop = get_default_shop()
        configuration.set(None, "key1", "test1")
        configuration.set(shop, "key2", "test2")

        # Shop configurations cache should be bumped
        assert cache.get(configuration._get_cache_key(shop)) is None
        configuration.get(shop, "key1")
        # Now shop configurations and key2 should found from cache
        assert cache.get(configuration._get_cache_key(shop)).get("key2") == "test2"