Regression test for mysterious uniqueness constraint when inserting into mongoengine

Closes #143  Thanks to tfausak for the test case.
This commit is contained in:
Ross Lawley 2011-05-19 09:55:34 +01:00
parent 95c2643f63
commit fb61c9a765

View File

@ -798,6 +798,25 @@ class DocumentTest(unittest.TestCase):
self.Person.drop_collection()
BlogPost.drop_collection()
def subclasses_and_unique_keys_works(self):
class A(Document):
pass
class B(A):
foo = BooleanField(unique=True)
A.drop_collection()
B.drop_collection()
A().save()
A().save()
B(foo=True).save()
self.assertEquals(A.objects.count(), 2)
self.assertEquals(B.objects.count(), 1)
A.drop_collection()
B.drop_collection()
def tearDown(self):
self.Person.drop_collection()