Added test for upsert & update_one #336

This commit is contained in:
Ross Lawley 2013-06-03 13:05:52 +00:00
parent 2fe1c20475
commit b2f78fadd9

View File

@ -545,6 +545,15 @@ class QuerySetTest(unittest.TestCase):
self.assertEqual("Bob", bob.name)
self.assertEqual(30, bob.age)
def test_upsert_one(self):
self.Person.drop_collection()
self.Person.objects(name="Bob", age=30).update_one(upsert=True)
bob = self.Person.objects.first()
self.assertEqual("Bob", bob.name)
self.assertEqual(30, bob.age)
def test_set_on_insert(self):
self.Person.drop_collection()