Пример #1
0
 def test_active_theme(self):
     with self.app.test_request_context('/'):
         appdata = render_template('active.html').strip()
         cooldata = render_theme_template('cool', 'active.html').strip()
         plaindata = render_theme_template('plain', 'active.html').strip()
         self.assertEqual(appdata, 'Application, Active theme: none')
         self.assertEqual(cooldata, 'Cool Blue v2, Active theme: cool')
         self.assertEqual(plaindata, 'Application, Active theme: plain')
Пример #2
0
 def test_extend(self):
     with self.app.test_request_context('/'):
         data = render_theme_template('cool', 'extending.html').strip()
         self.assertIsNotNone(data)
         self.assertEqual(data, 'hello I am theme_layout')
Пример #3
0
 def test_theme_static(self):
     with self.app.test_request_context('/'):
         coolurl = static_file_url('cool', 'style.css')
         cooldata = render_theme_template('cool', 'static.html').strip()
         self.assertEqual(cooldata, 'Cool Blue v2, {}'.format(coolurl))
Пример #4
0
 def test_render_theme_template(self):
     with self.app.test_request_context('/'):
         coolsrc = render_theme_template('cool', 'hello.html').strip()
         plainsrc = render_theme_template('plain', 'hello.html').strip()
         self.assertEqual(coolsrc, 'Hello from Cool Blue v2.')
         self.assertEqual(plainsrc, 'Hello from the application')