def test_populate(self):
from chroma_core.services.plugin_runner.resource_manager import EdgeIndex
resource_record, couplet_resource = self._make_global_resource('example_plugin', 'Couplet', {'address_1': 'foo', 'address_2': 'bar'})
controller_resource = self._make_local_resource('example_plugin', 'Controller', index = 0, parents = [couplet_resource])
self.resource_manager.session_open(self.plugin,
resource_record.pk,
[couplet_resource, controller_resource],
60)
# By not fetching the Couple and not fetching the plugin we should be left with 1 entry, this will raise an exception if the
# result is not 1 entry.
controller_record = StorageResourceRecord.objects.get(~Q(id = resource_record.pk), ~Q(id = self.plugin._scannable_id))
index = EdgeIndex()
index.populate()
self.assertEqual(index.get_parents(controller_record.pk), [resource_record.pk])
self.assertEqual(index.get_children(resource_record.pk), [controller_record.pk])
test_edit_index.py 文件源码
python
阅读 19
收藏 0
点赞 0
评论 0
评论列表
文章目录