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

Method test_multidirectional_lists

tests/test_dereference.py:1040–1062  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1038 Group.drop_collection()
1039
1040 def test_multidirectional_lists(self):
1041 class Asset(Document):
1042 name = StringField(max_length=250, required=True)
1043 path = StringField()
1044 title = StringField()
1045 parent = GenericReferenceField(default=None)
1046 parents = ListField(GenericReferenceField())
1047 children = ListField(GenericReferenceField())
1048
1049 Asset.drop_collection()
1050
1051 root = Asset(name="", path="/", title="Site Root")
1052 root.save()
1053
1054 company = Asset(name="company", title="Company", parent=root, parents=[root])
1055 company.save()
1056
1057 root.children = [company]
1058 root.save()
1059
1060 root = root.reload()
1061 assert root.children == [company]
1062 assert company.parents == [root]
1063
1064 def test_dict_in_dbref_instance(self):
1065 class Person(Document):

Callers

nothing calls this directly

Calls 4

AssetClass · 0.85
drop_collectionMethod · 0.80
reloadMethod · 0.80
saveMethod · 0.45

Tested by

no test coverage detected