diff options
author | Sunaina Pai <sunainapai.in@gmail.com> | 2018-08-11 10:47:51 +0530 |
---|---|---|
committer | Sunaina Pai <sunainapai.in@gmail.com> | 2018-08-11 10:47:51 +0530 |
commit | ddeb792ecedb4629aa7c8bc33c0eaba45b82b755 (patch) | |
tree | b072ac2b6e7d3663afa85fe44af7171e5141bce1 /test/test_pages.py | |
parent | 99c8e268a6c2c75943e1069ff95a5d64e1e19908 (diff) |
Do not use headers from one post in other posts
Diffstat (limited to 'test/test_pages.py')
-rw-r--r-- | test/test_pages.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/test_pages.py b/test/test_pages.py index 5fe7a4d..9f52fb7 100644 --- a/test/test_pages.py +++ b/test/test_pages.py @@ -18,6 +18,10 @@ class PagesTest(unittest.TestCase): f.write('Foo') with open(os.path.join(self.blog_path, '2018-01-02-bar.txt'), 'w') as f: f.write('Bar') + with open(os.path.join(self.blog_path, 'header-foo.txt'), 'w') as f: + f.write('<!-- tag: foo -->Foo') + with open(os.path.join(self.blog_path, 'header-bar.txt'), 'w') as f: + f.write('<!-- title: bar -->Bar') def tearDown(self): shutil.rmtree(self.blog_path) @@ -61,3 +65,15 @@ class PagesTest(unittest.TestCase): self.assertEqual(len(posts), 2) self.assertEqual(posts[0]['date'], '2018-01-02') self.assertEqual(posts[1]['date'], '2018-01-01') + + def test_content_header_params(self): + # Test that header params from one post is not used in another + # post. + src = os.path.join(self.blog_path, 'header*.txt') + dst = os.path.join(self.site_path, '{{ slug }}.txt') + tpl = '{{ title }}:{{ tag }}:{{ content }}' + makesite.make_pages(src, dst, tpl) + with open(os.path.join(self.site_path, 'header-foo.txt')) as f: + self.assertEqual(f.read(), '{{ title }}:foo:Foo') + with open(os.path.join(self.site_path, 'header-bar.txt')) as f: + self.assertEqual(f.read(), 'bar:{{ tag }}:Bar') |