Fix: Added and adjusted test_template

This commit is contained in:
Fabian Braun 2016-07-07 15:23:22 +02:00
parent a224fcca2e
commit 18959d35df
2 changed files with 15 additions and 9 deletions

View file

@ -160,12 +160,11 @@ By defining the setting ``BLOG_PLUGIN_TEMPLATE_FOLDERS`` you can allow multiple
To use this feature define ``BLOG_PLUGIN_TEMPLATE_FOLDERS`` as a list of available templates. Each item of this list itself is a list of the form ``('[folder_name]', '[verbose name]')``. Example:
BLOG_PLUGIN_TEMPLATE_FOLDERS = (
('plugins', _('Default template') ), # reads from "templates/djangocms_blog/plugins/
('timeline', _('Vertical timeline') ), # reads from "templates/djangocms_blog/vertical/
('masonry', _('Masonry style') ), # reads from "templates/djangocms_blog/masonry/
('plugins', _('Default template')), # reads from templates/djangocms_blog/plugins/
('timeline', _('Vertical timeline')), # reads from templates/djangocms_blog/vertical/
('masonry', _('Masonry style')), # reads from templates/djangocms_blog/masonry/
)
Once defined, the plugin admin interface will allow content managers to select which template the plugin will use.
.. _sitemap:

View file

@ -189,11 +189,18 @@ class PluginTest(BaseTest):
context = self.get_plugin_context(pages[0], 'en', plugin)
plugin_class = plugin.get_plugin_class_instance()
self.assertEqual(plugin_class.get_render_template(context, plugin, ph), os.path.join('djangocms_blog', plugin_class.base_render_template))
self.assertEqual(plugin_class.get_render_template(context, plugin, ph),
os.path.join('djangocms_blog', plugin.template_folder, plugin_class.base_render_template))
self.app_config_1.app_data.config.template_prefix = 'whatever'
self.app_config_1.save()
self.assertEqual(plugin_class.get_render_template(context, plugin, ph), os.path.join('whatever', plugin_class.base_render_template))
tmp = plugin.template_folder
plugin.template_folder = 'whereever'
plugin.save()
self.assertEqual(plugin_class.get_render_template(context, plugin, ph),
os.path.join('whatever', 'whereever', plugin_class.base_render_template))
plugin.template_folder = tmp
plugin.save()
self.app_config_1.app_data.config.template_prefix = ''
self.app_config_1.save()