Esempio n. 1
0
    def test_build_header_with_fields(self):
        header_data = [
            'Test Post',
            '2014-11-04',
            'Alexis Métaireau',
            ['Programming'],
            ['Pelican', 'Python'],
            'test-post',
        ]

        expected_docutils = '\n'.join([
            'Test Post',
            '#########',
            ':date: 2014-11-04',
            ':author: Alexis Métaireau',
            ':category: Programming',
            ':tags: Pelican, Python',
            ':slug: test-post',
            '\n',
        ])

        expected_md = '\n'.join([
            'Title: Test Post',
            'Date: 2014-11-04',
            'Author: Alexis Métaireau',
            'Category: Programming',
            'Tags: Pelican, Python',
            'Slug: test-post',
            '\n',
        ])

        self.assertEqual(build_header(*header_data), expected_docutils)
        self.assertEqual(build_markdown_header(*header_data), expected_md)
Esempio n. 2
0
    def test_build_header_with_east_asian_characters(self):
        header = build_header('これは広い幅の文字だけで構成されたタイトルです',
                None, None, None, None, None)

        self.assertEqual(header,
                'これは広い幅の文字だけで構成されたタイトルです\n' +
                '##############################################\n\n')
Esempio n. 3
0
 def test_galleries_added_to_header(self):
     header = build_header('test', None, None, None, None, None,
                           attachments=['output/test1', 'output/test2'])
     self.assertEqual(header, ('test\n####\n'
                               ':attachments: output/test1, '
                               'output/test2\n\n'))
Esempio n. 4
0
 def test_build_header(self):
     header = build_header('test', None, None, None, None, None)
     self.assertEqual(header, 'test\n####\n\n')
Esempio n. 5
0
 def test_build_header(self):
     header = build_header('test', None, None, None, None, None)
     self.assertEqual(header, 'test\n####\n\n')
Esempio n. 6
0
 def test_galleries_added_to_header(self):
     header = build_header('test', None, None, None, None, None,
                           attachments=['output/test1', 'output/test2'])
     self.assertEqual(header, ('test\n####\n'
                               ':attachments: output/test1, '
                               'output/test2\n\n'))