diff --git a/tests/conftest.py b/tests/conftest.py index 9d33ccf..e0776a0 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -24,3 +24,23 @@ def store_with_profiles(tmp_path): """, ("parmesan", json.dumps(["Depth", "Seasoning"]), 29.0, 29.0, 1.2, 1, 1600.0, 0, "neutral")) store.conn.commit() return store + + +@pytest.fixture +def store_with_recipes(store_with_profiles): + store_with_profiles.conn.executemany(""" + INSERT INTO recipes (external_id, title, ingredients, ingredient_names, + directions, category, keywords, element_coverage) + VALUES (?,?,?,?,?,?,?,?) + """, [ + ("1", "Butter Pasta", '["butter","pasta","parmesan"]', + '["butter","pasta","parmesan"]', '["boil pasta","toss with butter"]', + "Italian", '["quick","pasta"]', + '{"Richness":0.5,"Depth":0.3,"Structure":0.2}'), + ("2", "Lentil Soup", '["lentils","carrots","onion","broth"]', + '["lentils","carrots","onion","broth"]', '["simmer all"]', + "Soup", '["vegan","hearty"]', + '{"Depth":0.4,"Seasoning":0.3}'), + ]) + store_with_profiles.conn.commit() + return store_with_profiles diff --git a/tests/db/test_store_recipes.py b/tests/db/test_store_recipes.py index 43aa1b0..d98972d 100644 --- a/tests/db/test_store_recipes.py +++ b/tests/db/test_store_recipes.py @@ -1,26 +1,3 @@ -import pytest - - -@pytest.fixture -def store_with_recipes(store_with_profiles): - store_with_profiles.conn.executemany(""" - INSERT INTO recipes (external_id, title, ingredients, ingredient_names, - directions, category, keywords, element_coverage) - VALUES (?,?,?,?,?,?,?,?) - """, [ - ("1", "Butter Pasta", '["butter","pasta","parmesan"]', - '["butter","pasta","parmesan"]', '["boil pasta","toss with butter"]', - "Italian", '["quick","pasta"]', - '{"Richness":0.5,"Depth":0.3,"Structure":0.2}'), - ("2", "Lentil Soup", '["lentils","carrots","onion","broth"]', - '["lentils","carrots","onion","broth"]', '["simmer all"]', - "Soup", '["vegan","hearty"]', - '{"Depth":0.4,"Seasoning":0.3}'), - ]) - store_with_profiles.conn.commit() - return store_with_profiles - - def test_search_recipes_by_ingredient_names(store_with_recipes): results = store_with_recipes.search_recipes_by_ingredients(["butter", "parmesan"]) assert len(results) >= 1