def test_generate_html_file_unicode(self):
     generate.generate_html_file(
         template_filepath="unicode.html", output_dir="tests/www/", env=self.env, context={}, minify=False
     )
     self.assertTrue(os.path.isfile("tests/www/unicode/index.html"))
     with open("tests/files/unicode.html") as infile:
         with open("tests/www/unicode/index.html") as outfile:
             self.assertEqual(infile.read(), outfile.read())
 def test_generate_html_file_art(self):
     generate.generate_html_file(
         template_filepath="art/index.html", output_dir="tests/www/", env=self.env, context={}
     )
     self.assertTrue(os.path.isfile("tests/www/art/index.html"))
     self.assertFalse(os.path.isfile("tests/www/index.html"))
     self.assertFalse(os.path.isfile("tests/www/about/index.html"))
     self.assertFalse(os.path.isfile("tests/www/base/index.html"))
Example #3
0
 def test_generate_html_file(self):
     generate.generate_html_file(
         template_filepath='index.html',
         output_dir='tests/www/',
         env=self.env,
         context={}
     )
     self.assertTrue(os.path.isfile('tests/www/index.html'))
     self.assertFalse(os.path.isfile('tests/www/about/index.html'))
     self.assertFalse(os.path.isfile('tests/www/base/index.html'))
Example #4
0
 def test_generate_html_file_unicode(self):
     generate.generate_html_file(
         template_filepath='unicode.html',
         output_dir='tests/www/',
         env=self.env,
         context={}
     )
     self.assertTrue(os.path.isfile('tests/www/unicode/index.html'))
     with open('tests/files/unicode.html') as infile:
         with open('tests/www/unicode/index.html') as outfile:
             self.assertEqual(infile.read(), outfile.read())
 def test_generate_minified_html_file_unicode(self):
     generate.generate_html_file(
         template_filepath="unicode2.html", output_dir="tests/www/", env=self.env, context={}, minify=True
     )
     self.assertTrue(os.path.isfile("tests/www/unicode2/index.html"))
     expected = (
         "<!DOCTYPE html><html><body><p>This is the unicode test "
         "page.</p><p>Polish: Ą Ł Ż</p><p>Chinese:"
         " 倀 倁 倂 倃 倄 倅 倆 倇 倈</p><p>Musical Notes:"
         ' ♬ ♫ ♯</p><h3 class="panel-title">Paški sir</h3>'
         "<p>Croatian: š š</p></body></html>"
     )
     with open("tests/www/unicode2/index.html") as outfile:
         self.assertEqual(expected, outfile.read())
Example #6
0
 def test_generate_html_file(self):
     os.mkdir('tests/www/')
     env = Environment()
     env.loader = FileSystemLoader('tests/project/templates/')
     generate.generate_html_file(
         f='index.html', 
         output_dir='tests/www/',
         env=env,
         context={}
     )
     self.assertTrue(os.path.isfile('tests/www/index.html'))
     self.assertFalse(os.path.isfile('tests/www/about/index.html'))
     self.assertFalse(os.path.isfile('tests/www/base/index.html'))
     shutil.rmtree('tests/www')
Example #7
0
    def test_generate_html_file_unicode2(self):
        generate.generate_html_file(
            template_filepath='unicode2.html',
            output_dir='tests/www/',
            env=self.env,
            context={}
        )
        self.assertTrue(os.path.isfile('tests/www/unicode2/index.html'))
        expected = """<!DOCTYPE html>
<html>
<body>

<p>This is the unicode test page.</p>
<p>Polish: Ą Ł Ż</p>
<p>Chinese: 倀 倁 倂 倃 倄 倅 倆 倇 倈</p>
<p>Musical Notes: ♬ ♫ ♯</p>
<h3 class="panel-title">Paški sir</h3>
<p>Croatian: š š</p>

</body>
</html>"""
        with open('tests/www/unicode2/index.html') as outfile:
            self.assertEqual(expected, outfile.read())