Queries now return correct subclasses of Documents
This commit is contained in:
parent
0674e3c013
commit
744077b150
5 changed files with 119 additions and 10 deletions
|
|
@ -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__':
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue