Make sure that that `get_or_create` creates rows correctly when using joins.
(self)
| 194 | self.assertEqual(instance.popularity, 0) |
| 195 | |
| 196 | def test_joins(self): |
| 197 | """ |
| 198 | Make sure that that `get_or_create` creates rows correctly when using |
| 199 | joins. |
| 200 | """ |
| 201 | instance = ( |
| 202 | Band.objects() |
| 203 | .get_or_create( |
| 204 | (Band.name == "My new band") |
| 205 | & (Band.manager.name == "Excellent manager") |
| 206 | ) |
| 207 | .run_sync() |
| 208 | ) |
| 209 | self.assertIsInstance(instance, Band) |
| 210 | self.assertEqual(instance._was_created, True) |
| 211 | |
| 212 | # We want to make sure the band name isn't 'Excellent manager' by |
| 213 | # mistake. |
| 214 | self.assertEqual(Band.name, "My new band") |
| 215 | |
| 216 | def test_prefetch_existing_object(self): |
| 217 | """ |
nothing calls this directly
no test coverage detected