summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton I. Sipos <aisipos@gmail.com>2012-11-04 18:23:03 -0800
committerPreston Holmes <preston@ptone.com>2012-11-04 18:43:11 -0800
commitfdea2621cd3f3de472afaab7aa7152a1dc4f505c (patch)
treed065acf9ecf94558bc75d19c6493f1f026e9fddd
parent79a484fc8e2f62262e91d5073282c6f0ec497b01 (diff)
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.
-rw-r--r--tests/modeltests/model_forms/tests.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/tests/modeltests/model_forms/tests.py b/tests/modeltests/model_forms/tests.py
index 46d5af565a..c47de45ef7 100644
--- a/tests/modeltests/model_forms/tests.py
+++ b/tests/modeltests/model_forms/tests.py
@@ -1060,7 +1060,10 @@ class OldFormForXTests(TestCase):
# Add a Category object *after* the ModelMultipleChoiceField has already been
# instantiated. This proves clean() checks the database during clean() rather
# 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.assertQuerysetEqual(f.clean([c6.id]), ["Sixth"])