MCPcopy
hub / github.com/django/django / test_db_selection

Method test_db_selection

tests/multiple_database/tests.py:1390–1398  ·  view source on GitHub ↗

Querysets obey the router for db suggestions

(self)

Source from the content-addressed store, hash-verified

1388 databases = {"default", "other"}
1389
1390 def test_db_selection(self):
1391 "Querysets obey the router for db suggestions"
1392 self.assertEqual(Book.objects.db, "other")
1393 self.assertEqual(Book.objects.all().db, "other")
1394
1395 self.assertEqual(Book.objects.using("default").db, "default")
1396
1397 self.assertEqual(Book.objects.db_manager("default").db, "default")
1398 self.assertEqual(Book.objects.db_manager("default").all().db, "default")
1399
1400 def test_migrate_selection(self):
1401 "Synchronization behavior is predictable"

Callers

nothing calls this directly

Calls 3

db_managerMethod · 0.80
allMethod · 0.45
usingMethod · 0.45

Tested by

no test coverage detected