Deleting a proxy-of-proxy instance should bubble through to its proxy and non-proxy parents, deleting *all* referring objects.
(self)
| 213 | self.assertEqual(len(FooFile.objects.all()), 0) |
| 214 | |
| 215 | def test_delete_proxy_of_proxy(self): |
| 216 | """ |
| 217 | Deleting a proxy-of-proxy instance should bubble through to its proxy |
| 218 | and non-proxy parents, deleting *all* referring objects. |
| 219 | """ |
| 220 | test_image = self.create_image() |
| 221 | |
| 222 | # Get the Image as a Photo |
| 223 | test_photo = Photo.objects.get(pk=test_image.pk) |
| 224 | foo_photo = FooPhoto(my_photo=test_photo) |
| 225 | foo_photo.save() |
| 226 | |
| 227 | Photo.objects.all().delete() |
| 228 | |
| 229 | # A Photo deletion == Image deletion == File deletion |
| 230 | self.assertEqual(len(Photo.objects.all()), 0) |
| 231 | self.assertEqual(len(Image.objects.all()), 0) |
| 232 | self.assertEqual(len(File.objects.all()), 0) |
| 233 | |
| 234 | # The Photo deletion should have cascaded and deleted *all* |
| 235 | # references to it. |
| 236 | self.assertEqual(len(FooPhoto.objects.all()), 0) |
| 237 | self.assertEqual(len(FooFile.objects.all()), 0) |
| 238 | self.assertEqual(len(FooImage.objects.all()), 0) |
| 239 | |
| 240 | def test_delete_concrete_parent(self): |
| 241 | """ |