test that the output of the samples pelican project is correct

(functionnal testing)
This commit is contained in:
Bruno Binet 2012-03-30 13:44:57 +02:00
commit 2f1f6b5b43

View file

@ -1,13 +1,15 @@
import unittest
import os
from filecmp import dircmp
from .support import temporary_folder
from pelican import Pelican
from pelican.settings import read_settings
SAMPLES_PATH = os.path.abspath(os.sep.join(
(os.path.dirname(os.path.abspath(__file__)), "..", "samples")))
CURRENT_DIR = os.path.dirname(os.path.abspath(__file__))
SAMPLES_PATH = os.path.abspath(os.sep.join((CURRENT_DIR, "..", "samples")))
OUTPUT_PATH = os.path.abspath(os.sep.join((CURRENT_DIR, "output")))
INPUT_PATH = os.path.join(SAMPLES_PATH, "content")
SAMPLE_CONFIG = os.path.join(SAMPLES_PATH, "pelican.conf.py")
@ -24,8 +26,18 @@ class TestPelican(unittest.TestCase):
with temporary_folder() as temp_path:
pelican = Pelican(path=INPUT_PATH, output_path=temp_path)
pelican.run()
diff = dircmp(temp_path, os.sep.join((OUTPUT_PATH, "basic")))
self.assertEqual(diff.left_only, [])
self.assertEqual(diff.right_only, [])
self.assertEqual(diff.diff_files, [])
# the same thing with a specified set of settins should work
def test_custom_generation_works(self):
# the same thing with a specified set of settings should work
with temporary_folder() as temp_path:
pelican = Pelican(path=INPUT_PATH, output_path=temp_path,
settings=read_settings(SAMPLE_CONFIG))
pelican.run()
diff = dircmp(temp_path, os.sep.join((OUTPUT_PATH, "custom")))
self.assertEqual(diff.left_only, [])
self.assertEqual(diff.right_only, [])
self.assertEqual(diff.diff_files, [])