-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Since the Pelican team is making things harder and harder, I'll just …
…remove the tests. Thanks folks, very useful.
- Loading branch information
Showing
4 changed files
with
2 additions
and
95 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
14 changes: 0 additions & 14 deletions
14
pelican/plugins/mau_reader/test_data/article_with_content.mau
This file was deleted.
Oops, something went wrong.
7 changes: 0 additions & 7 deletions
7
pelican/plugins/mau_reader/test_data/article_with_nonascii_metadata.mau
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |