Moved change to right place and added fancier test

This commit is contained in:
Matthieu Rigal 2015-06-26 17:58:53 +02:00
parent 4525eb457b
commit 4dc158589c
2 changed files with 25 additions and 1 deletions

View File

@ -4,6 +4,7 @@ Changelog
Changes in 0.10.1 - DEV
=======================
- Fix infinite recursion with CASCADE delete rules under specific conditions. #1046
Changes in 0.10.0
=================
@ -34,7 +35,6 @@ Changes in 0.10.0
- Allow dynamic lookup for more than two parts. #882
- Added support for min_distance on geo queries. #831
- Allow to add custom metadata to fields #705
- Fix infinite recursion with CASCADE delete rules under specific conditions. #1046
Changes in 0.9.0
================

View File

@ -1430,6 +1430,30 @@ class QuerySetTest(unittest.TestCase):
self.assertRaises(DoesNotExist, base.reload)
self.assertRaises(DoesNotExist, other.reload)
def test_reverse_delete_rule_cascade_complex_cycle(self):
"""Ensure reference cascading doesn't loop if reference graph isn't
a tree
"""
class Category(Document):
name = StringField()
class Dummy(Document):
reference = ReferenceField('self', reverse_delete_rule=CASCADE)
cat = ReferenceField(Category, reverse_delete_rule=CASCADE)
cat = Category(name='cat').save()
base = Dummy(cat=cat).save()
other = Dummy(reference=base).save()
other2 = Dummy(reference=other).save()
base.reference = other
base.save()
cat.delete()
self.assertRaises(DoesNotExist, base.reload)
self.assertRaises(DoesNotExist, other.reload)
self.assertRaises(DoesNotExist, other2.reload)
def test_reverse_delete_rule_cascade_self_referencing(self):
"""Ensure self-referencing CASCADE deletes do not result in infinite
loop