diff options
Diffstat (limited to 'ishtar_common/tests.py')
| -rw-r--r-- | ishtar_common/tests.py | 24 | 
1 files changed, 24 insertions, 0 deletions
| diff --git a/ishtar_common/tests.py b/ishtar_common/tests.py index c92872612..1460e7b66 100644 --- a/ishtar_common/tests.py +++ b/ishtar_common/tests.py @@ -67,6 +67,7 @@ from ishtar_common.serializers_utils import serialization_info  from ishtar_common.utils import post_save_geo, update_data, move_dict_data, \      rename_and_simplify_media_name, try_fix_file  from ishtar_common.tasks import launch_export +from ishtar_common import utils_secretary  COMMON_FIXTURES = [ @@ -2757,3 +2758,26 @@ class DocumentTest(TestCase):          doc3.save()          doc3 = models.Document.objects.get(pk=doc3.pk)          self.assertEqual(doc3.complete_identifier, 'no-code') + + +class JinjaFilterTest(TestCase): +    def test_splitpart(self): +        self.assertEqual(utils_secretary.splitpart("1,2,3", 1), "2") +        self.assertEqual(utils_secretary.splitpart("1,2,3", 10), "") +        self.assertEqual(utils_secretary.splitpart("1;2;3", 2, ";"), "3") + +    def test_human_date(self): +        self.assertEqual(utils_secretary.human_date_filter("NODATE"), "") +        self.assertEqual( +            utils_secretary.human_date_filter("2020-01-01"), +            "1 janvier 2020") + +    def test_capfirst(self): +        self.assertEqual( +            utils_secretary.capfirst_filter("SAINT GEORGES D'OLÉRON"), +            "Saint georges d'oléron") + +    def test_capitalize(self): +        self.assertEqual( +            utils_secretary.capitalize_filter("SAINT-GEORGES D'OLÉRON"), +            "Saint-Georges d'Oléron") | 
