Organize gallery into highlighted photo groups
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
import os
|
||||
import runpy
|
||||
import tempfile
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
from unittest.mock import patch
|
||||
|
||||
|
||||
class PhotoManifestTest(unittest.TestCase):
|
||||
def test_photo_receipts_accept_single_and_double_quoted_ids(self):
|
||||
first = "a" * 64
|
||||
second = "b" * 64
|
||||
with tempfile.TemporaryDirectory() as directory:
|
||||
root = Path(directory)
|
||||
(root / "_site/art").mkdir(parents=True)
|
||||
(root / "_site/snippets").mkdir(parents=True)
|
||||
(root / "_site/art/index.html").write_text(
|
||||
f'<span id="photo-{first}"></span><span id=\'photo-{second}\'></span>'
|
||||
)
|
||||
(root / "_site/snippets/index.html").write_text("")
|
||||
|
||||
with patch("os.environ", {"GITHUB_SHA": "test-commit"}):
|
||||
old_cwd = Path.cwd()
|
||||
try:
|
||||
os.chdir(root)
|
||||
script = Path(__file__).resolve().parents[1] / "photo-manifest.py"
|
||||
runpy.run_path(str(script))
|
||||
finally:
|
||||
os.chdir(old_cwd)
|
||||
|
||||
manifest = (root / "_site/photo-publication.json").read_text()
|
||||
self.assertIn(first, manifest)
|
||||
self.assertIn(second, manifest)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user