Add test that confirms slug is re-computed when value changes

This commit is contained in:
Swen Kooij 2017-06-26 14:01:25 +03:00
parent 3ce57ed4cc
commit 32696f4e1e

View File

@ -81,6 +81,14 @@ class LocalizedSlugFieldTestCase(TestCase):
assert old_slug_en == obj.slug.en
assert old_slug_nl != obj.slug.nl
@classmethod
def test_unique_slug_update(cls):
obj = cls.Model.objects.create(title={settings.LANGUAGE_CODE: 'mytitle'})
assert obj.slug.get() == 'mytitle'
obj.title.set(settings.LANGUAGE_CODE, 'othertitle')
obj.save()
assert obj.slug.get() == 'othertitle'
@classmethod
def test_unique_slug_unique_max_retries(cls):
"""Tests whether the unique slug implementation doesn't