Queries now return correct subclasses of Documents

This commit is contained in:
Harry Marr
2009-11-19 19:44:51 +00:00
parent 0674e3c013
commit 744077b150
5 changed files with 119 additions and 10 deletions

View File

@@ -107,6 +107,8 @@ class CollectionManagerTest(unittest.TestCase):
content = StringField()
author = EmbeddedDocumentField(User)
self.db.drop_collection(BlogPost._meta['collection'])
post = BlogPost(content='Had a good coffee today...')
post.author = User(name='Test User')
post.save()
@@ -114,6 +116,8 @@ class CollectionManagerTest(unittest.TestCase):
result = BlogPost.objects.find_one()
self.assertTrue(isinstance(result.author, User))
self.assertEqual(result.author.name, 'Test User')
self.db.drop_collection(BlogPost._meta['collection'])
if __name__ == '__main__':