Permalink
Browse files

Test files_to_copy

  • Loading branch information...
saimn committed Jan 6, 2018
1 parent 219a730 commit e35d95557a31b39e5d497808574920cf305a221e
Showing with 12 additions and 2 deletions.
  1. +2 −2 sigal/compat.py
  2. +2 −0 tests/sample/sigal.conf.py
  3. +8 −0 tests/test_cli.py
View
@@ -35,7 +35,7 @@
from urllib.parse import quote as url_quote
import socketserver
import pickle
else:
else: # pragma: no cover
text_type = unicode # NOQA
string_types = (str, unicode) # NOQA
unichr = unichr
@@ -56,5 +56,5 @@ def strxfrm(s):
class UnicodeMixin(object):
if not PY2:
__str__ = lambda x: x.__unicode__()
else:
else: # pragma: no cover
__str__ = lambda x: unicode(x).encode('utf-8')
@@ -9,6 +9,8 @@
links = [('Example link', 'http://example.org'),
('Another link', 'http://example.org')]
files_to_copy = (('../watermark.png', 'watermark.png'),)
plugins = ['sigal.plugins.adjust', 'sigal.plugins.copyright',
'sigal.plugins.watermark', 'sigal.plugins.feeds',
'sigal.plugins.nomedia', 'sigal.plugins.extended_caching']
View
@@ -58,6 +58,7 @@ def test_build(tmpdir):
text += """
theme = 'colorbox'
files_to_copy = (('../watermark.png', 'watermark.png'),)
plugins = ['sigal.plugins.adjust', 'sigal.plugins.copyright',
'sigal.plugins.watermark', 'sigal.plugins.feeds',
'sigal.plugins.media_page' 'sigal.plugins.nomedia',
@@ -75,12 +76,14 @@ def test_build(tmpdir):
f.write(text)
result = runner.invoke(build, ['pictures', 'build',
'--title', 'Testing build',
'-n', 1, '--debug'])
assert result.exit_code == 0
assert os.path.isfile(join(tmpdir, 'build', 'thumbnails',
'exo20101028-b-full.jpg'))
assert os.path.isfile(join(tmpdir, 'build', 'feed.atom'))
assert os.path.isfile(join(tmpdir, 'build', 'feed.rss'))
assert os.path.isfile(join(tmpdir, 'build', 'watermark.png'))
finally:
os.chdir(cwd)
# Reset logger
@@ -140,3 +143,8 @@ def test_set_meta(tmpdir):
assert result.output.startswith("1 metadata key(s) written to")
assert os.path.isfile(str(tmpdir.join("test.md")))
assert tmpdir.join("test.md").read() == "Title: testing\n"
result = runner.invoke(set_meta, [str(testfile), "title"])
assert result.exit_code == 1
assert result.output.startswith("Need an even number of arguments")

0 comments on commit e35d955

Please sign in to comment.