1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
|
import os
from unittest import TestCase
from . import utils as test_utils
class TestNav(test_utils.MockSiteTestMixin, TestCase):
"""
Test metadata collected on site load
"""
def test_dir(self):
self.maxDiff = None
files = {
"index.md": {"nav": ["about.md"]},
"about.md": {},
"dir1/dir2/dir3/page.md": {},
}
with self.site(files) as mocksite:
page = mocksite.page("dir1/dir2/dir3/page")
self.assertEqual(
page.to_dict(),
{
"src": {
"relpath": "dir1/dir2/dir3/page.md",
"abspath": os.path.join(
mocksite.site.content_root, "dir1/dir2/dir3/page.md"
),
},
"build_path": "dir1/dir2/dir3/page/index.html",
"site_path": "dir1/dir2/dir3/page",
"meta": {
"author": "Test User",
"copyright": "© 2019 Test User",
"date": "2019-06-01 12:30:00+02:00",
"draft": False,
"indexed": True,
"nav": ["MarkdownPage(about)"],
"syndicated": True,
"syndication_date": "2019-06-01 12:30:00+02:00",
"site_name": "Test site",
"site_url": "https://www.example.org",
"template": "page.html",
"template_copyright": "compiled:None",
"title": "Test site",
"related": {},
},
"type": "markdown",
},
)
|