summaryrefslogtreecommitdiff
path: root/tests/regressiontests/multiple_database/tests.py
diff options
context:
space:
mode:
authorAymeric Augustin <aymeric.augustin@m4x.org>2012-11-23 10:02:18 +0100
committerAymeric Augustin <aymeric.augustin@m4x.org>2012-11-23 10:02:18 +0100
commit2875b5dcab23c027d019656b08da8b911bc60711 (patch)
tree6fda91e6d4323ef5ffd88c00e9c29f0f952e4607 /tests/regressiontests/multiple_database/tests.py
parentc13912ac7f8d5af6e0d3091d627981c005f08130 (diff)
Tweak a test to avoid hitting a limit with SQLite.
Django cannot delete more than 999 objects at a time with SQLite. Refs #16426, #16039.
Diffstat (limited to 'tests/regressiontests/multiple_database/tests.py')
-rw-r--r--tests/regressiontests/multiple_database/tests.py15
1 files changed, 9 insertions, 6 deletions
diff --git a/tests/regressiontests/multiple_database/tests.py b/tests/regressiontests/multiple_database/tests.py
index a1d9e93524..a903ea11a0 100644
--- a/tests/regressiontests/multiple_database/tests.py
+++ b/tests/regressiontests/multiple_database/tests.py
@@ -1912,18 +1912,21 @@ class SyncDBTestCase(TestCase):
def test_syncdb_to_other_database(self):
"""Regression test for #16039: syncdb with --database option."""
- count = ContentType.objects.count()
+ cts = ContentType.objects.using('other').filter(app_label='multiple_database')
+
+ count = cts.count()
self.assertGreater(count, 0)
- ContentType.objects.using('other').delete()
+ cts.delete()
management.call_command('syncdb', verbosity=0, interactive=False,
load_initial_data=False, database='other')
-
- self.assertEqual(ContentType.objects.using("other").count(), count)
+ self.assertEqual(cts.count(), count)
def test_syncdb_to_other_database_with_router(self):
"""Regression test for #16039: syncdb with --database option."""
- ContentType.objects.using('other').delete()
+ cts = ContentType.objects.using('other').filter(app_label='multiple_database')
+
+ cts.delete()
try:
old_routers = router.routers
router.routers = [SyncOnlyDefaultDatabaseRouter()]
@@ -1932,4 +1935,4 @@ class SyncDBTestCase(TestCase):
finally:
router.routers = old_routers
- self.assertEqual(ContentType.objects.using("other").count(), 0)
+ self.assertEqual(cts.count(), 0)