diff options
Diffstat (limited to 'ishtar_common/tests.py')
| -rw-r--r-- | ishtar_common/tests.py | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/ishtar_common/tests.py b/ishtar_common/tests.py index 577594fda..dec0f5256 100644 --- a/ishtar_common/tests.py +++ b/ishtar_common/tests.py @@ -52,10 +52,10 @@ from django.core.files.uploadedfile import SimpleUploadedFile from django.core.management import call_command from django.db.models.fields import BooleanField from django.db.models.fields.related import ForeignKey -from django.template.defaultfilters import slugify from django.test import TestCase as BaseTestCase from django.test.client import Client from django.test.runner import DiscoverRunner +from django.utils.text import slugify from django.utils.translation import ugettext_lazy as _ from django.urls import reverse @@ -3348,7 +3348,8 @@ class ImportTest(BaseImportTest): ot = models.OrganizationType.objects.create(label=label) self.assertEqual( models.ItemKey.objects.filter( - object_id=ot.pk, key=slugify(label), content_type=content_type + object_id=ot.pk, key=slugify(label, allow_unicode=True), + content_type=content_type ).count(), 1, ) @@ -3356,24 +3357,26 @@ class ImportTest(BaseImportTest): ot_2 = models.OrganizationType.objects.create(label=label_2) self.assertEqual( models.ItemKey.objects.filter( - object_id=ot_2.pk, key=slugify(label_2), content_type=content_type + object_id=ot_2.pk, key=slugify(label_2, allow_unicode=True), + content_type=content_type ).count(), 1, ) # replace key - ot_2.add_key(slugify(label), force=True) + ot_2.add_key(slugify(label, allow_unicode=True), force=True) # one key point to only one item self.assertEqual( models.ItemKey.objects.filter( - key=slugify(label), content_type=content_type + key=slugify(label, allow_unicode=True), content_type=content_type ).count(), 1, ) # this key point to the right item self.assertEqual( models.ItemKey.objects.filter( - object_id=ot_2.pk, key=slugify(label), content_type=content_type + object_id=ot_2.pk, key=slugify(label, allow_unicode=True), + content_type=content_type ).count(), 1, ) @@ -3381,12 +3384,13 @@ class ImportTest(BaseImportTest): # modification label_3 = "Yop" ot_2.label = label_3 - ot_2.txt_idx = slugify(label_3) + ot_2.txt_idx = slugify(label_3, allow_unicode=True) ot_2.save() # old label not referenced anymore self.assertEqual( models.ItemKey.objects.filter( - object_id=ot_2.pk, key=slugify(label_2), content_type=content_type + object_id=ot_2.pk, key=slugify(label_2, allow_unicode=True), + content_type=content_type ).count(), 0, ) @@ -3394,13 +3398,15 @@ class ImportTest(BaseImportTest): # new key is here self.assertEqual( models.ItemKey.objects.filter( - object_id=ot_2.pk, key=slugify(label), content_type=content_type + object_id=ot_2.pk, key=slugify(label, allow_unicode=True), + content_type=content_type ).count(), 1, ) self.assertEqual( models.ItemKey.objects.filter( - object_id=ot_2.pk, key=slugify(label_3), content_type=content_type + object_id=ot_2.pk, key=slugify(label_3, allow_unicode=True), + content_type=content_type ).count(), 1, ) |
