'Tests language_fallback placeholder configuration'

def test_plugins_non_default_language_fallback(self):

    page_en = create_page('page_en', 'col_two.html', 'en')
    create_title('de', 'page_de', page_en)
    placeholder_en = page_en.placeholders.get(slot='col_left')
    placeholder_de = page_en.placeholders.get(slot='col_left')
    add_plugin(placeholder_de, 'TextPlugin', 'de', body='de    body')
    context_en = SekizaiContext()
    context_en['request'] = self.get_request(language='en', page=page_en)
    context_de = SekizaiContext()
    context_de['request'] = self.get_request(language='de', page=page_en)
    content_de = _render_placeholder(placeholder_en, context_de)
    self.assertRegexpMatches(content_de, '^de    body$')
    del placeholder_en._plugins_cache
    cache.clear()
    content_en = _render_placeholder(placeholder_en, context_en)
    self.assertRegexpMatches(content_en, '^de    body$')
    self.assertEqual(len(content_en), 7)
    del placeholder_en._plugins_cache
    cache.clear()
    conf = {'col_left': {'language_fallback': False}}
    with self.settings(CMS_PLACEHOLDER_CONF=conf):
        content_en = _render_placeholder(placeholder_en, context_en)
        self.assertNotRegex(content_en, '^de    body$')
        del placeholder_en._plugins_cache
        cache.clear()
        add_plugin(placeholder_en, 'TextPlugin', 'en', body='en    body')
        content_en = _render_placeholder(placeholder_en, context_en)
        self.assertRegexpMatches(content_en, '^en    body$')
