コード例 #1
0
def test_theme_selection():
    """
    Test that a theme with a `template_dir` actually affects template directory selection.
    """
    with override_current_theme_class(), override_provides("xtheme", [
        "shoop_tests.xtheme.utils:FauxTheme",
        "shoop_tests.xtheme.utils:FauxTheme2",
        "shoop_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", " ")
コード例 #2
0
def test_theme_activation():
    with override_current_theme_class():
        with override_provides("xtheme", [
            "shoop_tests.xtheme.utils:FauxTheme",
            "shoop_tests.xtheme.utils:FauxTheme2"
        ]):
            ThemeSettings.objects.all().delete()
            assert not get_current_theme()
            set_current_theme(FauxTheme.identifier)
            assert isinstance(get_current_theme(), FauxTheme)
            set_current_theme(FauxTheme2.identifier)
            assert isinstance(get_current_theme(), FauxTheme2)
            with pytest.raises(ValueError):
                set_current_theme(printable_gibberish())
コード例 #3
0
 def setUp(self):
     super(ReservableViewsBaseTestCase, self).setUp()
     activate("en")
     set_current_theme("shoop_simple_theme")
     self.client = Client()
コード例 #4
0
 def handle(self, *args, **options):
     translation.activate("en")
     self.seed_default()
     self.import_data()
     set_current_theme("shoop_beauty_theme")
コード例 #5
0
 def handle(self, *args, **options):
     translation.activate("en")
     self.seed_default()
     self.import_data()
     set_current_theme("wintergear")
コード例 #6
0
 def setUp(self):
     super(ReservableViewsBaseTestCase, self).setUp()
     activate("en")
     set_current_theme("shoop_simple_theme")
     self.client = Client()