Loading tests/update/tests.py +11 −2 Original line number Diff line number Diff line Loading @@ -2,7 +2,7 @@ from __future__ import unicode_literals from django.test import TestCase from .models import A, B, C, D, DataPoint, RelatedPoint from .models import A, B, D, DataPoint, RelatedPoint class SimpleTest(TestCase): Loading Loading @@ -51,6 +51,15 @@ class SimpleTest(TestCase): cnt = D.objects.filter(y=100).count() self.assertEqual(cnt, 0) def test_foreign_key_update_with_id(self): """ Test that update works using <field>_id for foreign keys """ num_updated = self.a1.d_set.update(a_id=self.a2) self.assertEqual(num_updated, 20) self.assertEqual(self.a2.d_set.count(), 20) class AdvancedTests(TestCase): def setUp(self): Loading Loading
tests/update/tests.py +11 −2 Original line number Diff line number Diff line Loading @@ -2,7 +2,7 @@ from __future__ import unicode_literals from django.test import TestCase from .models import A, B, C, D, DataPoint, RelatedPoint from .models import A, B, D, DataPoint, RelatedPoint class SimpleTest(TestCase): Loading Loading @@ -51,6 +51,15 @@ class SimpleTest(TestCase): cnt = D.objects.filter(y=100).count() self.assertEqual(cnt, 0) def test_foreign_key_update_with_id(self): """ Test that update works using <field>_id for foreign keys """ num_updated = self.a1.d_set.update(a_id=self.a2) self.assertEqual(num_updated, 20) self.assertEqual(self.a2.d_set.count(), 20) class AdvancedTests(TestCase): def setUp(self): Loading