Added test for upsert & update_one #336
This commit is contained in:
parent
2fe1c20475
commit
b2f78fadd9
@ -545,6 +545,15 @@ class QuerySetTest(unittest.TestCase):
|
|||||||
self.assertEqual("Bob", bob.name)
|
self.assertEqual("Bob", bob.name)
|
||||||
self.assertEqual(30, bob.age)
|
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):
|
def test_set_on_insert(self):
|
||||||
self.Person.drop_collection()
|
self.Person.drop_collection()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user