Added test for reloading of strict with special fields #1156
This commit is contained in:
parent
ed8174fe36
commit
3c18f79ea4
@ -557,6 +557,28 @@ class InstanceTest(unittest.TestCase):
|
|||||||
except Exception:
|
except Exception:
|
||||||
self.assertFalse("Threw wrong exception")
|
self.assertFalse("Threw wrong exception")
|
||||||
|
|
||||||
|
def test_reload_of_non_strict_with_special_field_name(self):
|
||||||
|
"""Ensures reloading works for documents with meta strict == False
|
||||||
|
"""
|
||||||
|
class Post(Document):
|
||||||
|
meta = {
|
||||||
|
'strict': False
|
||||||
|
}
|
||||||
|
title = StringField()
|
||||||
|
items = ListField()
|
||||||
|
|
||||||
|
Post.drop_collection()
|
||||||
|
|
||||||
|
Post._get_collection().insert_one({
|
||||||
|
"title": "Items eclipse",
|
||||||
|
"items": ["more lorem", "even more ipsum"]
|
||||||
|
})
|
||||||
|
|
||||||
|
post = Post.objects.first()
|
||||||
|
post.reload()
|
||||||
|
self.assertEqual(post.title, "Items eclipse")
|
||||||
|
self.assertEqual(post.items, ["more lorem", "even more ipsum"])
|
||||||
|
|
||||||
def test_dictionary_access(self):
|
def test_dictionary_access(self):
|
||||||
"""Ensure that dictionary-style field access works properly.
|
"""Ensure that dictionary-style field access works properly.
|
||||||
"""
|
"""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user