def test__get_tags_used_in_content(self):
        JanitorTestModel.objects.create(
            content="<p><strong>Hi</strong><em>World</em></p>"
        )
        fs = FieldSanitizer(content_type=self.ct, field_name="content")
        fs.save()

        tags = sorted(_get_tags_used_in_content())
        self.assertEqual(tags, ['em', 'p', 'strong'])
 def test_default_clean(self):
     """Creates an instance of the test model with some sample content,
     then verifies that it gets cleaned upon saving.
     """
     fs = FieldSanitizer(content_type=self.ct, field_name="content")
     fs.save()
     obj = self.test_model(content=self.sample_content)
     obj.save()
     self.assertEqual(obj.content, self.cleaned_content)
     self.assertEqual(fs.app_name, 'tests')
     self.assertEqual(fs.model_name, 'janitortestmodel')
 def test_strip_content(self):
     """Adds an HTML comment to the class's sample content, then verifies
     that it gets removed.
     """
     fs = FieldSanitizer(
         content_type=self.ct,
         field_name="content",
         strip=True,
         strip_comments=True
     )
     fs.save()
     obj = self.test_model(content="<!-- Hello! -->" + self.sample_content)
     obj.save()
     self.assertEqual(obj.content, self.stripped_content)