Skip to content

Commit 32696f4

Browse files
committed
Add test that confirms slug is re-computed when value changes
1 parent 3ce57ed commit 32696f4

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

tests/test_slug_fields.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,14 @@ def test_uniue_slug_no_change(cls):
8181
assert old_slug_en == obj.slug.en
8282
assert old_slug_nl != obj.slug.nl
8383

84+
@classmethod
85+
def test_unique_slug_update(cls):
86+
obj = cls.Model.objects.create(title={settings.LANGUAGE_CODE: 'mytitle'})
87+
assert obj.slug.get() == 'mytitle'
88+
obj.title.set(settings.LANGUAGE_CODE, 'othertitle')
89+
obj.save()
90+
assert obj.slug.get() == 'othertitle'
91+
8492
@classmethod
8593
def test_unique_slug_unique_max_retries(cls):
8694
"""Tests whether the unique slug implementation doesn't

0 commit comments

Comments
 (0)