Skip to content

Commit

Permalink
Test cleansing
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiask committed Feb 12, 2024
1 parent 7160186 commit bec2c63
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/testapp/test_cleanse.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from django.db import models
from django.test import TestCase
from django.test.utils import isolate_apps

from feincms3.cleanse import CleansedRichTextField


class Test(TestCase):
@isolate_apps("testapp")
def test_mixin(self):
class Thing(models.Model): # noqa: DJ008
text = CleansedRichTextField()

thing = Thing(text="<script>Hello</script>World")
thing.full_clean()
self.assertEqual(thing.text, "World")
3 changes: 3 additions & 0 deletions tests/testapp/test_feincms3.py
Original file line number Diff line number Diff line change
Expand Up @@ -1231,6 +1231,9 @@ def test_language_and_translation_of_mixin_in_app(self):
title="Neues", language_code="de", translation_of=original
)

self.assertEqual(str(original), "News")
self.assertEqual(str(translated), "Neues")

self.assertEqual(
[language["object"] for language in translations(original.translations())],
[original, translated, None],
Expand Down

0 comments on commit bec2c63

Please sign in to comment.