From 2f1f6b5b436d25a7ff13bccd096a1da226f56261 Mon Sep 17 00:00:00 2001 From: Bruno Binet Date: Fri, 30 Mar 2012 13:44:57 +0200 Subject: [PATCH] test that the output of the samples pelican project is correct (functionnal testing) --- tests/test_pelican.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/tests/test_pelican.py b/tests/test_pelican.py index ce270955..80e5fc7f 100644 --- a/tests/test_pelican.py +++ b/tests/test_pelican.py @@ -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, [])