MCPcopy Index your code
hub / github.com/MongoEngine/mongoengine / test_save

Method test_save

tests/document/test_instance.py:1022–1036  ·  view source on GitHub ↗

Ensure that a document may be saved in the database.

(self)

Source from the content-addressed store, hash-verified

1020 ] == ["lorem", "ipsum"]
1021
1022 def test_save(self):
1023 """Ensure that a document may be saved in the database."""
1024
1025 # Create person object and save it to the database
1026 person = self.Person(name="Test User", age=30)
1027 person.save()
1028
1029 # Ensure that the object is in the database
1030 raw_doc = get_as_pymongo(person)
1031 assert raw_doc == {
1032 "_cls": "Person",
1033 "name": "Test User",
1034 "age": 30,
1035 "_id": person.id,
1036 }
1037
1038 def test_save_write_concern(self):
1039 class Recipient(Document):

Callers

nothing calls this directly

Calls 2

get_as_pymongoFunction · 0.90
saveMethod · 0.45

Tested by

no test coverage detected