added tests for push and push_all
This commit is contained in:
		| @@ -51,6 +51,17 @@ class TransformTest(unittest.TestCase): | ||||
|         update = transform.update(DicDoc, pull__dictField__test=doc) | ||||
|         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): | ||||
|         """Ensure that the correct field name is used when querying. | ||||
|         """ | ||||
|   | ||||
		Reference in New Issue
	
	Block a user