Kaydet (Commit) fdea2621 authored tarafından Anton I. Sipos's avatar Anton I. Sipos Kaydeden (comit) Preston Holmes

Fixed #18949 -- Fix broken test interactions in ModelForms tests

A test in Model Forms test was specifically referring to a fixed
primary key, which was now being used up in a newly committed.
This has been worked around by specifying a higher primary
key.
üst 79a484fc
...@@ -1060,7 +1060,10 @@ class OldFormForXTests(TestCase): ...@@ -1060,7 +1060,10 @@ class OldFormForXTests(TestCase):
# Add a Category object *after* the ModelMultipleChoiceField has already been # Add a Category object *after* the ModelMultipleChoiceField has already been
# instantiated. This proves clean() checks the database during clean() rather # instantiated. This proves clean() checks the database during clean() rather
# than caching it at time of instantiation. # than caching it at time of instantiation.
c6 = Category.objects.create(id=6, name='Sixth', url='6th') # Note, we are using an id of 1006 here since tests that run before
# this may create categories with primary keys up to 6. Use
# a number that is will not conflict.
c6 = Category.objects.create(id=1006, name='Sixth', url='6th')
self.assertEqual(c6.name, 'Sixth') self.assertEqual(c6.name, 'Sixth')
self.assertQuerysetEqual(f.clean([c6.id]), ["Sixth"]) self.assertQuerysetEqual(f.clean([c6.id]), ["Sixth"])
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment