20 lines
522 B
Python
20 lines
522 B
Python
from pathlib import Path
|
|
|
|
from pyfakefs.fake_filesystem import FakeFilesystem
|
|
from pytest import fixture
|
|
|
|
from jwebsite.site import Site
|
|
|
|
|
|
@fixture
|
|
def site_dir(datadir: Path, fs: FakeFilesystem):
|
|
fs.add_real_directory(datadir)
|
|
yield fs
|
|
|
|
|
|
def test_render_page(datadir: Path, site_dir: FakeFilesystem):
|
|
site = Site(datadir)
|
|
site.render("index.j2", "index.html")
|
|
with open(datadir / "build" / "index.html", encoding="utf-8") as ouput_file:
|
|
assert ouput_file.read() == "<p>Peter</p><p>Steven</p>"
|