kiwi/tests/db/test_store_recipes.py
pyr0ball 8f4a7bd207
Some checks failed
CI / Backend (Python) (push) Has been cancelled
CI / Frontend (Vue) (push) Has been cancelled
Mirror / mirror (push) Has been cancelled
fix(tests): move store_with_recipes fixture to conftest.py for cross-module visibility
2026-07-07 22:10:42 -07:00

32 lines
1.4 KiB
Python

def test_search_recipes_by_ingredient_names(store_with_recipes):
results = store_with_recipes.search_recipes_by_ingredients(["butter", "parmesan"])
assert len(results) >= 1
assert any(r["title"] == "Butter Pasta" for r in results)
def test_search_recipes_respects_limit(store_with_recipes):
results = store_with_recipes.search_recipes_by_ingredients(["butter"], limit=1)
assert len(results) <= 1
def test_check_rate_limit_first_call(store_with_recipes):
allowed, count = store_with_recipes.check_and_increment_rate_limit("leftover_mode", daily_max=5)
assert allowed is True
assert count == 1
def test_check_rate_limit_exceeded(store_with_recipes):
for _ in range(5):
store_with_recipes.check_and_increment_rate_limit("leftover_mode", daily_max=5)
allowed, count = store_with_recipes.check_and_increment_rate_limit("leftover_mode", daily_max=5)
assert allowed is False
assert count == 5
def test_get_element_profiles_returns_known_items(store_with_profiles):
profiles = store_with_profiles.get_element_profiles(["butter", "parmesan", "unknown_item"])
assert profiles["butter"] == ["Richness"]
assert "Depth" in profiles["parmesan"]
assert "unknown_item" not in profiles
def test_get_element_profiles_empty_list(store_with_profiles):
profiles = store_with_profiles.get_element_profiles([])
assert profiles == {}