Fixed EmbeddedDocuments with id also storing _id (#402)
This commit is contained in:
parent
6c599ef506
commit
d593f7e04b
2 changed files with 11 additions and 2 deletions
|
|
@ -444,6 +444,13 @@ class InstanceTest(unittest.TestCase):
|
|||
self.assertEqual(Employee(name="Bob", age=35, salary=0).to_mongo().keys(),
|
||||
['_cls', 'name', 'age', 'salary'])
|
||||
|
||||
def test_embedded_document_to_mongo_id(self):
|
||||
class SubDoc(EmbeddedDocument):
|
||||
id = StringField(required=True)
|
||||
|
||||
sub_doc = SubDoc(id="abc")
|
||||
self.assertEqual(sub_doc.to_mongo().keys(), ['id'])
|
||||
|
||||
def test_embedded_document(self):
|
||||
"""Ensure that embedded documents are set up correctly.
|
||||
"""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue