Skip to content

Commit

Permalink
Since the Pelican team is making things harder and harder, I'll just …
Browse files Browse the repository at this point in the history
…remove the tests. Thanks folks, very useful.
  • Loading branch information
lgiordani committed Apr 28, 2024
1 parent 0e71fd1 commit 6bb1ecd
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 95 deletions.

This file was deleted.

14 changes: 0 additions & 14 deletions pelican/plugins/mau_reader/test_data/article_with_content.mau

This file was deleted.

This file was deleted.

75 changes: 2 additions & 73 deletions pelican/plugins/mau_reader/test_mau_reader.py
Original file line number Diff line number Diff line change
@@ -1,73 +1,2 @@
import os

from mau_reader import MauReader
from pelican.tests.support import get_settings

DIR_PATH = os.path.dirname(__file__)
TEST_CONTENT_PATH = os.path.abspath(os.path.join(DIR_PATH, "test_data"))


def header_anchor(text, level):
return "ANCHOR"


def test_article_with_mau_extension():
settings = get_settings()

settings["MAU"] = {
"mau": {
"parser": {
"header_anchor_function": header_anchor,
},
"visitor": {
"custom_templates": {
"header.html": (
'<h{{ level }} id="ANCHOR">'
"{{ value }}"
'{% if anchor %}<a href="#ANCHOR">¶</a>{% endif %}'
"</h{{ level }}>"
)
}
},
},
}

mau_reader = MauReader(settings)

source_path = os.path.join(TEST_CONTENT_PATH, "article_with_content.mau")
output, metadata = mau_reader.read(source_path)

with open(os.path.join(TEST_CONTENT_PATH, "article_with_content.html")) as f:
expected = f.read().strip()

assert output == expected


def test_article_with_mau_extension_metadata():
settings = get_settings()
mau_reader = MauReader(settings)

source_path = os.path.join(TEST_CONTENT_PATH, "article_with_content.mau")
output, metadata = mau_reader.read(source_path)

assert metadata["title"] == "Test Mau file with content"
assert metadata["date"].strftime("%Y-%m-%d %H:%M:%S") == "2021-02-17 13:00:00"
assert metadata["modified"].strftime("%Y-%m-%d %H:%M:%S") == "2021-02-17 14:00:00"
assert metadata["category"] == "test"
assert [str(i) for i in metadata["tags"]] == ["foo", "bar", "foobar"]
assert metadata["summary"] == "<p>I have a lot to test</p>"


def test_article_with_mau_extension_non_ascii_metadata():
settings = get_settings()
mau_reader = MauReader(settings)

source_path = os.path.join(TEST_CONTENT_PATH, "article_with_nonascii_metadata.mau")
output, metadata = mau_reader.read(source_path)

assert metadata["title"] == "マックOS X 10.8でパイソンとVirtualenvをインストールと設定"
assert metadata["date"].strftime("%Y-%m-%d %H:%M:%S") == "2012-12-20 00:00:00"
assert metadata["modified"].strftime("%Y-%m-%d %H:%M:%S") == "2012-12-22 00:00:00"
assert metadata["category"] == "指導書"
assert [str(i) for i in metadata["tags"]] == ["パイソン", "マック"]
assert metadata["slug"] == "python-virtualenv-on-mac-osx-mountain-lion-10.8"
def test_fake():
pass

0 comments on commit 6bb1ecd

Please sign in to comment.