mirror of
https://github.com/hay-kot/mealie.git
synced 2025-08-21 22:13:31 -07:00
fix tests
This commit is contained in:
parent
1f0ccaad2f
commit
0ae4fb4af8
6 changed files with 0 additions and 92 deletions
|
@ -1,24 +0,0 @@
|
|||
|
||||
|
||||

|
||||
|
||||
# {{ 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 }}
|
|
@ -1,5 +0,0 @@
|
|||
from pathlib import Path
|
||||
|
||||
CWD = Path(__file__).parent
|
||||
|
||||
recipes_markdown = CWD / "recipes.md"
|
|
@ -1,24 +0,0 @@
|
|||
|
||||
|
||||

|
||||
|
||||
# {{ 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 }}
|
|
@ -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)
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue