Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions render_engine_parser/base_parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,12 @@ def parse(
return content

@staticmethod
def create_entry(*, filepath: pathlib.Path | None, content: str = "Hello World", **kwargs) -> str:
def create_entry(*, content: str = None, **kwargs) -> str:
"""
Writes the content type that would be parsed to the content_path.

attrs:
filepath: Only used if reading from an existing path
"""

post = frontmatter.Post(content)
post = frontmatter.Post(content=content or "")

for key, val in kwargs.items():
post[key] = val
Expand Down
8 changes: 7 additions & 1 deletion tests/test_base_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,15 @@ def test_base_parser_parse_content_path(base_content_path):
assert expected_result == BasePageParser.parse_content_path(base_content_path)


def test_base_parser_empty_entry():
"""Tests that no content is required"""
data = BasePageParser.create_entry()
post = frontmatter.loads(data)
assert post.content == ""


def test_base_parser_net_entry():
data = BasePageParser.create_entry(
filepath=None, # reminder this is ignored in the base case
content="This is a Test",
title="Untitled Entry",
slug="untitled-entry",
Expand Down