Consolidate test site fixture into a single make_site
This commit is contained in:
@@ -2,28 +2,30 @@ from pathlib import Path
|
||||
from omicron.ssg.output.file import File
|
||||
|
||||
|
||||
def test_write_copies_content(thin_site, tmp_path):
|
||||
def test_write_copies_content(make_site, tmp_path):
|
||||
site = make_site("thin_site")
|
||||
source = tmp_path / "source.txt"
|
||||
source.write_text("hello")
|
||||
dest_dir = thin_site.output_path / "assets"
|
||||
dest_dir = site.output_path / "assets"
|
||||
dest_dir.mkdir(parents=True)
|
||||
|
||||
file = File(thin_site, Path("assets/copy.txt"), source)
|
||||
file = File(site, Path("assets/copy.txt"), source)
|
||||
file.write()
|
||||
|
||||
dest = dest_dir / "copy.txt"
|
||||
assert dest.read_text() == "hello"
|
||||
|
||||
|
||||
def test_write_overwrites_existing_destination(thin_site, tmp_path):
|
||||
dest = thin_site.output_path / "copy.txt"
|
||||
def test_write_overwrites_existing_destination(make_site, tmp_path):
|
||||
site = make_site("thin_site")
|
||||
dest = site.output_path / "copy.txt"
|
||||
dest.parent.mkdir(parents=True, exist_ok=True)
|
||||
dest.write_text("old")
|
||||
|
||||
source = tmp_path / "source.txt"
|
||||
source.write_text("new")
|
||||
|
||||
file = File(thin_site, Path("copy.txt"), source)
|
||||
file = File(site, Path("copy.txt"), source)
|
||||
file.write()
|
||||
|
||||
assert dest.read_text() == "new"
|
||||
|
||||
Reference in New Issue
Block a user