Browse Source

Add test

pull/469/head
tudacs 4 years ago
parent
commit
03454021ea
  1. 7
      tests/sample/sigal.conf.py
  2. 11
      tests/test_plugins.py

7
tests/sample/sigal.conf.py

@ -21,6 +21,7 @@ plugins = [
"sigal.plugins.nomedia",
"sigal.plugins.watermark",
"sigal.plugins.zip_gallery",
"sigal.plugins.titleregexp",
]
copyright = "© An example copyright message"
adjust_options = {
@ -39,6 +40,12 @@ thumb_size = (200, 150)
rss_feed = {"feed_url": "http://127.0.0.1:8000/feed.rss", "nb_items": 10}
atom_feed = {"feed_url": "http://127.0.0.1:8000/feed.atom", "nb_items": 10}
titleregexp = {
"regexp": [
{ "search": r"test ?(.*)", "replace": r"titleregexp \1" }
]
}
# theme = 'photoswipe'
# theme = 'galleria'
# thumb_size = (280, 210)

11
tests/test_plugins.py

@ -47,3 +47,14 @@ def test_nonmedia_files(settings, tmpdir, disconnect_signals):
settings['destination'], 'nonmedia_files', 'thumbnails', 'dummy.tn.jpg'
)
assert os.path.isfile(outthumb)
def test_titleregexp(settings, tmpdir, disconnect_signals):
if "sigal.plugins.titleregexp" not in settings["plugins"]:
settings['plugins'] += ["sigal.plugins.titleregexp"]
init_plugins(settings)
gal = Gallery(settings)
gal.build()
assert gal.albums.get('dir1').albums[1].title == "titleregexp 2"

Loading…
Cancel
Save