def test_get_default_category_name_caching(tag_category_factory):
    category1 = tag_category_factory()
    category2 = tag_category_factory()
    db.session.add_all([category1, category2])
    db.session.flush()
    tag_categories.get_default_category_name()
    db.session.delete(category1)
    db.session.flush()
    assert tag_categories.get_default_category_name() == category1.name
    cache.purge()
    assert tag_categories.get_default_category_name() == category2.name
Exemple #2
0
def test_get_default_category_name_caching(tag_category_factory):
    category1 = tag_category_factory()
    category2 = tag_category_factory()
    db.session.add_all([category1, category2])
    db.session.flush()
    tag_categories.get_default_category_name()
    db.session.delete(category1)
    db.session.flush()
    assert tag_categories.get_default_category_name() == category1.name
    cache.purge()
    assert tag_categories.get_default_category_name() == category2.name
Exemple #3
0
def test_get_default_category_name(tag_category_factory):
    category1 = tag_category_factory()
    category2 = tag_category_factory(default=True)
    db.session.add_all([category1, category2])
    db.session.flush()
    assert tag_categories.get_default_category_name() == category2.name
    category2.default = False
    db.session.flush()
    cache.purge()
    assert tag_categories.get_default_category_name() == category1.name
    db.session.query(db.TagCategory).delete()
    cache.purge()
    assert tag_categories.get_default_category_name() is None
Exemple #4
0
def test_get_default_category_name(tag_category_factory):
    category1 = tag_category_factory()
    category2 = tag_category_factory(default=True)
    db.session.add_all([category1, category2])
    db.session.flush()
    assert tag_categories.get_default_category_name() == category2.name
    category2.default = False
    db.session.flush()
    cache.purge()
    assert tag_categories.get_default_category_name() == category1.name
    db.session.query(model.TagCategory).delete()
    cache.purge()
    with pytest.raises(tag_categories.TagCategoryNotFoundError):
        tag_categories.get_default_category_name()
def test_get_default_category_name(tag_category_factory):
    category1 = tag_category_factory()
    category2 = tag_category_factory(default=True)
    db.session.add_all([category1, category2])
    db.session.flush()
    assert tag_categories.get_default_category_name() == category2.name
    category2.default = False
    db.session.flush()
    cache.purge()
    assert tag_categories.get_default_category_name() == category1.name
    db.session.query(model.TagCategory).delete()
    cache.purge()
    with pytest.raises(tag_categories.TagCategoryNotFoundError):
        tag_categories.get_default_category_name()
Exemple #6
0
def purge_cache():
    cache.purge()
def purge_cache():
    cache.purge()
Exemple #8
0
def process_request(ctx: rest.Context) -> None:
    if ctx.method != "GET":
        cache.purge()
Exemple #9
0
def process_request(ctx):
    if ctx.method != 'GET':
        cache.purge()
Exemple #10
0
def process_request(ctx: rest.Context) -> None:
    if ctx.method != 'GET':
        cache.purge()