MCPcopy
hub / github.com/django/django / test_delete_proxy_of_proxy

Method test_delete_proxy_of_proxy

tests/delete_regress/tests.py:215–238  ·  view source on GitHub ↗

Deleting a proxy-of-proxy instance should bubble through to its proxy and non-proxy parents, deleting *all* referring objects.

(self)

Source from the content-addressed store, hash-verified

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 """

Callers

nothing calls this directly

Calls 6

create_imageMethod · 0.95
FooPhotoClass · 0.85
getMethod · 0.45
saveMethod · 0.45
deleteMethod · 0.45
allMethod · 0.45

Tested by

no test coverage detected