@pytest.mark.django_db
def test_theme_selection():
 with override_current_theme_class():
  with override_provides('xtheme', ['shuup_tests.xtheme.utils:FauxTheme', 'shuup_tests.xtheme.utils:FauxTheme2', 'shuup_tests.xtheme.utils:H2G2Theme']):
   ThemeSettings.objects.all().delete()
   for theme in get_provide_objects('xtheme'):
    set_current_theme(theme.identifier)
    je = get_jinja2_engine()
    wrapper = (noop() if (theme.identifier == 'h2g2') else pytest.raises(TemplateDoesNotExist))
    with wrapper:
     t = je.get_template('42.jinja')
     content = t.render().strip()
     assert ('a slice of lemon wrapped around a large gold brick' in content.replace('\n', ' '))

@ pytest . mark . django_db def test_theme_selection ( ) : with override_current_theme_class ( ) : with override_provides ( 'xtheme' , [ 'shuup_tests.xtheme.utils:FauxTheme' , 'shuup_tests.xtheme.utils:FauxTheme2' , 'shuup_tests.xtheme.utils:H2G2Theme' ] ) : ThemeSettings . objects . all ( ) . delete ( ) for theme in get_provide_objects ( 'xtheme' ) : set_current_theme ( theme . identifier ) je = get_jinja2_engine ( ) wrapper = ( noop ( ) if ( theme . identifier == 'h2g2' ) else pytest . raises ( TemplateDoesNotExist ) ) with wrapper : t = je . get_template ( '42.jinja' ) content = t . render ( ) . strip ( ) assert ( 'a slice of lemon wrapped around a large gold brick' in content . replace ( '\n' , ' ' ) )
test that a theme with a template_dir actually affects template directory selection .