diff --git a/dev/data/templates/recipes.md b/dev/data/templates/recipes.md deleted file mode 100644 index eda4c6e14..000000000 --- a/dev/data/templates/recipes.md +++ /dev/null @@ -1,24 +0,0 @@ - - -![Recipe Image](../../images/{{ recipe.slug }}/original.jpg) - -# {{ recipe.name }} -{{ recipe.description }} - -## Ingredients -{% for ingredient in recipe.recipeIngredient %} -- [ ] {{ ingredient }} {% endfor %} - -## Instructions -{% for step in recipe.recipeInstructions %} -- [ ] {{ step.text }} {% endfor %} - -{% for note in recipe.notes %} -**{{ note.title }}:** {{ note.text }} -{% endfor %} - ---- - -Tags: {{ recipe.tags }} -Categories: {{ recipe.categories }} -Original URL: {{ recipe.orgURL }} diff --git a/mealie/assets/templates/__init__.py b/mealie/assets/templates/__init__.py deleted file mode 100644 index 7c3db204f..000000000 --- a/mealie/assets/templates/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -from pathlib import Path - -CWD = Path(__file__).parent - -recipes_markdown = CWD / "recipes.md" diff --git a/mealie/assets/templates/recipes.md b/mealie/assets/templates/recipes.md deleted file mode 100644 index eda4c6e14..000000000 --- a/mealie/assets/templates/recipes.md +++ /dev/null @@ -1,24 +0,0 @@ - - -![Recipe Image](../../images/{{ recipe.slug }}/original.jpg) - -# {{ recipe.name }} -{{ recipe.description }} - -## Ingredients -{% for ingredient in recipe.recipeIngredient %} -- [ ] {{ ingredient }} {% endfor %} - -## Instructions -{% for step in recipe.recipeInstructions %} -- [ ] {{ step.text }} {% endfor %} - -{% for note in recipe.notes %} -**{{ note.title }}:** {{ note.text }} -{% endfor %} - ---- - -Tags: {{ recipe.tags }} -Categories: {{ recipe.categories }} -Original URL: {{ recipe.orgURL }} diff --git a/mealie/core/settings/directories.py b/mealie/core/settings/directories.py index f55032444..86a4dc1dc 100644 --- a/mealie/core/settings/directories.py +++ b/mealie/core/settings/directories.py @@ -1,8 +1,5 @@ -import shutil from pathlib import Path -from mealie.assets import templates - class AppDirectories: def __init__(self, data_dir: Path) -> None: @@ -38,9 +35,3 @@ class AppDirectories: for dir in required_dirs: dir.mkdir(parents=True, exist_ok=True) - - # Bootstrap Templates - markdown_template = self.TEMPLATE_DIR.joinpath("recipes.md") - - if not markdown_template.exists(): - shutil.copyfile(templates.recipes_markdown, markdown_template) diff --git a/mealie/routes/recipe/_base.py b/mealie/routes/recipe/_base.py index 146cbe2bb..8a48a8744 100644 --- a/mealie/routes/recipe/_base.py +++ b/mealie/routes/recipe/_base.py @@ -32,7 +32,6 @@ class JSONBytes(JSONResponse): class FormatResponse(BaseModel): jjson: list[str] = Field(..., alias="json") zip: list[str] - jinja2: list[str] class BaseRecipeController(BaseCrudController): diff --git a/tests/integration_tests/user_recipe_tests/test_recipe_export_as.py b/tests/integration_tests/user_recipe_tests/test_recipe_export_as.py index 7729a437e..37e25d44a 100644 --- a/tests/integration_tests/user_recipe_tests/test_recipe_export_as.py +++ b/tests/integration_tests/user_recipe_tests/test_recipe_export_as.py @@ -18,28 +18,9 @@ def test_get_available_exports(api_client: TestClient, unique_user: TestUser) -> as_json = response.json() - assert "recipes.md" in as_json["jinja2"] assert "raw" in as_json["json"] -def test_render_jinja_template(api_client: TestClient, unique_user: TestUser) -> None: - # Create Recipe - recipe_name = random_string() - response = api_client.post(api_routes.recipes, json={"name": recipe_name}, headers=unique_user.token) - assert response.status_code == 201 - slug = response.json() - - # Render Template - response = api_client.get( - api_routes.recipes_slug_exports(slug) + "?template_name=recipes.md", headers=unique_user.token - ) - assert response.status_code == 200 - - # Assert Template is Rendered Correctly - # TODO: More robust test - assert f"# {recipe_name}" in response.text - - def test_get_recipe_as_zip(api_client: TestClient, unique_user: TestUser) -> None: # Create Recipe recipe_name = random_string() @@ -61,13 +42,3 @@ def test_get_recipe_as_zip(api_client: TestClient, unique_user: TestUser) -> Non with zipfile.ZipFile(zip_file, "r") as zip_fp: with zip_fp.open(f"{slug}.json") as json_fp: assert json.loads(json_fp.read())["name"] == recipe_name - - -# TODO: Allow users to upload templates to their own directory -# def test_upload_template(api_client: TestClient, unique_user: TestUser) -> None: -# assert False - - -# # TODO: Allow users to upload templates to their own directory -# def test_delete_template(api_client: TestClient, unique_user: TestUser) -> None: -# assert False