diff --git a/pelican/tests/test_utils.py b/pelican/tests/test_utils.py index 9a7109d6..09b6180d 100644 --- a/pelican/tests/test_utils.py +++ b/pelican/tests/test_utils.py @@ -491,6 +491,9 @@ class TestCopy(unittest.TestCase): self.assertTrue(os.path.exists(path), 'Directory does not exist: %s' % path) + def _create_symlink(self, path, *name): + os.symlink(path, os.path.join(self.root_dir, *name)) + def test_copy_file_same_path(self): self._create_file('a.txt') utils.copy(os.path.join(self.root_dir, 'a.txt'), @@ -547,6 +550,20 @@ class TestCopy(unittest.TestCase): self._exist_dir('b0', 'b1', 'b2', 'b3', 'b') self._exist_file('b0', 'b1', 'b2', 'b3', 'b', 'a.txt') + def test_copy_symlink(self): + self._create_dir('f') + self._create_dir('q') + self._create_dir('q', 'r') + self._create_file('q', 'r', 'f.txt') + sympathy = os.path.join(self.root_dir, 'q') + self._create_symlink(sympathy, 'f', 'q') + utils.copy(os.path.join(self.root_dir, 'f'), + os.path.join(self.root_dir, 'm')) + self._exist_dir('m') + self._exist_dir('m', 'q') + self._exist_dir('m', 'q', 'r') + self._exist_file('m', 'q', 'r', 'f.txt') + class TestDateFormatter(unittest.TestCase): '''Tests that the output of DateFormatter jinja filter is same as