test the raw() method across databases
(self)
| 1240 | self.assertEqual(dive.get_previous_by_published().title, "Learning Python") |
| 1241 | |
| 1242 | def test_raw(self): |
| 1243 | "test the raw() method across databases" |
| 1244 | dive = Book.objects.using("other").create( |
| 1245 | title="Dive into Python", published=datetime.date(2009, 5, 4) |
| 1246 | ) |
| 1247 | val = Book.objects.db_manager("other").raw( |
| 1248 | "SELECT id FROM multiple_database_book" |
| 1249 | ) |
| 1250 | self.assertQuerySetEqual(val, [dive.pk], attrgetter("pk")) |
| 1251 | |
| 1252 | val = Book.objects.raw("SELECT id FROM multiple_database_book").using("other") |
| 1253 | self.assertQuerySetEqual(val, [dive.pk], attrgetter("pk")) |
| 1254 | |
| 1255 | def test_select_related(self): |
| 1256 | """ |
nothing calls this directly
no test coverage detected