added tests for push and push_all
This commit is contained in:
parent
9e80da705a
commit
38fdf26405
@ -51,6 +51,17 @@ class TransformTest(unittest.TestCase):
|
|||||||
update = transform.update(DicDoc, pull__dictField__test=doc)
|
update = transform.update(DicDoc, pull__dictField__test=doc)
|
||||||
self.assertTrue(isinstance(update["$pull"]["dictField"]["test"], dict))
|
self.assertTrue(isinstance(update["$pull"]["dictField"]["test"], dict))
|
||||||
|
|
||||||
|
def test_transform_update_push(self):
|
||||||
|
"""Ensure the differences in behvaior between 'push' and 'push_all'"""
|
||||||
|
class BlogPost(Document):
|
||||||
|
tags = ListField(StringField())
|
||||||
|
|
||||||
|
update = transform.update(BlogPost, push__tags=['mongo', 'db'])
|
||||||
|
self.assertEqual(update, {'$push': {'tags': ['mongo', 'db']}})
|
||||||
|
|
||||||
|
update = transform.update(BlogPost, push_all__tags=['mongo', 'db'])
|
||||||
|
self.assertEqual(update, {'$push': {'tags': {'$each': ['mongo', 'db']}}})
|
||||||
|
|
||||||
def test_query_field_name(self):
|
def test_query_field_name(self):
|
||||||
"""Ensure that the correct field name is used when querying.
|
"""Ensure that the correct field name is used when querying.
|
||||||
"""
|
"""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user