Ejemplo n.º 1
0
    def test_delete_cached_returns_false_when_delete_fails(self):
        """Test CACHE delete_cached returns False if deletion is not successful"""
        @cache(key_prefix='my_cached_func')
        def my_func():
            return 'my_func was called'

        key = "%s::%s" % (settings_test.REDIS_KEYPREFIX, 'my_cached_func')
        assert test_sentinel.master.keys() == []

        delete_succedeed = delete_cached('my_cached_func')
        assert delete_succedeed is False, delete_succedeed
Ejemplo n.º 2
0
def reset():
    """Clean the cache"""
    delete_cached('front_page_top_projects')
    delete_cached('number_featured_projects')
    delete_cached('number_published_projects')
    delete_cached('number_draft_projects')
    delete_memoized(get_all_projects)
    delete_memoized(get_all_featured)
    delete_memoized(get_all_draft)
    delete_memoized(text_search)
    delete_memoized(n_total_tasks)
    delete_memoized(n_count)
    delete_memoized(get_all)
Ejemplo n.º 3
0
    def test_delete_cached_returns_false_when_delete_fails(self):
        """Test CACHE delete_cached returns False if deletion is not successful"""

        @cache(key_prefix='my_cached_func')
        def my_func():
            return 'my_func was called'
        key = "%s::%s" % (REDIS_KEYPREFIX, 'my_cached_func')
        assert test_sentinel.master.keys() == []

        delete_succedeed = delete_cached('my_cached_func')
        assert delete_succedeed is False, delete_succedeed
Ejemplo n.º 4
0
    def test_delete_cached_returns_true_when_delete_succeeds(self):
        """Test CACHE delete_cached deletes a stored key and returns True if
        deletion is successful"""
        @cache(key_prefix='my_cached_func')
        def my_func():
            return 'my_func was called'

        key = "%s::%s" % (settings_test.REDIS_KEYPREFIX, 'my_cached_func')
        my_func()
        assert test_sentinel.master.keys() == [key]

        delete_succedeed = delete_cached('my_cached_func')
        assert delete_succedeed is True, delete_succedeed
        assert test_sentinel.master.keys() == [], 'Key was not deleted!'
Ejemplo n.º 5
0
    def test_delete_cached_returns_true_when_delete_succeeds(self):
        """Test CACHE delete_cached deletes a stored key and returns True if
        deletion is successful"""

        @cache(key_prefix='my_cached_func')
        def my_func():
            return 'my_func was called'
        key = "%s::%s" % (REDIS_KEYPREFIX, 'my_cached_func')
        my_func()
        assert test_sentinel.master.keys() == [key]

        delete_succedeed = delete_cached('my_cached_func')
        assert delete_succedeed is True, delete_succedeed
        assert test_sentinel.master.keys() == [], 'Key was not deleted!'
Ejemplo n.º 6
0
def reset():
    """Clean the cache"""
    delete_cached('categories_all')
    delete_cached('categories_used')
def reset():
    """Clean the cache"""
    delete_cached("index_front_page")
    delete_cached('front_page_featured_projects')
    delete_cached('front_page_top_projects')
    delete_cached('number_featured_projects')
    delete_cached('number_published_projects')
    delete_cached('number_draft_projects')
    delete_memoized(get_all_featured)
    delete_memoized(get_all_draft)
    delete_memoized(n_count)
    delete_memoized(get_all)
Ejemplo n.º 8
0
def reset():
    """Clean the cache"""
    delete_cached('categories_all')
    delete_cached('categories_used')
Ejemplo n.º 9
0
def reset():
    """Clean the cache"""
    delete_cached("index_front_page")
    delete_cached('front_page_featured_apps')
    delete_cached('front_page_top_apps')
    delete_cached('number_featured_apps')
    delete_cached('number_published_apps')
    delete_cached('number_draft_apps')
    delete_memoized(get_featured)
    delete_memoized(get_draft)
    delete_memoized(n_count)
    delete_memoized(get)
Ejemplo n.º 10
0
def reset():
    """Clean the cache"""
    delete_cached("index_front_page")
    delete_cached("front_page_featured_projects")
    delete_cached("front_page_top_projects")
    delete_cached("number_featured_projects")
    delete_cached("number_published_projects")
    delete_cached("number_draft_projects")
    delete_memoized(get_all_featured)
    delete_memoized(get_all_draft)
    delete_memoized(n_count)
    delete_memoized(get_all)