def test_custom(self):
        """
        If custom css is allowed, changes to the css don't raise a validation
        error.

        """
        tier = self.create_tier(custom_css=True)
        self.create_tier_info(tier)

        data = {'css': 'foo'}
        site_settings = SiteSettings.objects.get_current()
        site_settings.css = 'bar'
        form = EditSettingsForm(data, instance=site_settings)
        form.cleaned_data = data
        self.assertEqual(form.clean_css(), data['css'])
Beispiel #2
0
    def test_custom(self):
        """
        If custom css is allowed, changes to the css don't raise a validation
        error.

        """
        tier = self.create_tier(custom_css=True)
        self.create_tier_info(tier)

        data = {'css': 'foo'}
        site_settings = SiteSettings.objects.get_current()
        site_settings.css = 'bar'
        form = EditSettingsForm(data, instance=site_settings)
        form.cleaned_data = data
        self.assertEqual(form.clean_css(), data['css'])
    def test_no_custom__match(self):
        """
        Even if custom css isn't allowed, we do let it through if it matches
        the css that is already stored.

        """
        tier = self.create_tier(custom_css=False)
        self.create_tier_info(tier)

        data = {'css': 'foo'}
        site_settings = SiteSettings.objects.get_current()
        site_settings.css = data['css']
        form = EditSettingsForm(data, instance=site_settings)
        form.cleaned_data = data
        self.assertEqual(form.clean_css(), data['css'])
Beispiel #4
0
    def test_no_custom__match(self):
        """
        Even if custom css isn't allowed, we do let it through if it matches
        the css that is already stored.

        """
        tier = self.create_tier(custom_css=False)
        self.create_tier_info(tier)

        data = {'css': 'foo'}
        site_settings = SiteSettings.objects.get_current()
        site_settings.css = data['css']
        form = EditSettingsForm(data, instance=site_settings)
        form.cleaned_data = data
        self.assertEqual(form.clean_css(), data['css'])