本文整理汇总了Python中nailgun.plugins.manager.PluginManager.sync_plugins_metadata方法的典型用法代码示例。如果您正苦于以下问题:Python PluginManager.sync_plugins_metadata方法的具体用法?Python PluginManager.sync_plugins_metadata怎么用?Python PluginManager.sync_plugins_metadata使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nailgun.plugins.manager.PluginManager
的用法示例。
在下文中一共展示了PluginManager.sync_plugins_metadata方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: POST
# 需要导入模块: from nailgun.plugins.manager import PluginManager [as 别名]
# 或者: from nailgun.plugins.manager.PluginManager import sync_plugins_metadata [as 别名]
def POST(self):
""":returns: JSONized REST object.
:http: * 200 (plugins successfully synced)
* 404 (plugin not found in db)
* 400 (problem with parsing metadata file)
"""
data = self.checked_data()
ids = data.get("ids", None)
try:
PluginManager.sync_plugins_metadata(plugin_ids=ids)
except errors.ParseError as exc:
raise self.http(400, msg=six.text_type(exc))
raise self.http(200)
示例2: test_removes_tasks_from_db_if_removed_from_new_plugin
# 需要导入模块: from nailgun.plugins.manager import PluginManager [as 别名]
# 或者: from nailgun.plugins.manager.PluginManager import sync_plugins_metadata [as 别名]
def test_removes_tasks_from_db_if_removed_from_new_plugin(self):
plugin = self.env.create_plugin(
tasks=self.env.get_default_plugin_tasks())
mocked_metadata = {
'metadata.yaml': {},
'environment_config.yaml': {},
}
self.assertNotEqual(plugin.tasks, [])
with mock.patch(
'nailgun.plugins.loaders.files_manager.FilesManager.load'
) as load:
def se(key):
# Simulate that tasks.yaml was removed
if key.endswith('tasks.yaml'):
raise errors.NoPluginFileFound()
return copy.deepcopy(
mocked_metadata.get(os.path.basename(key)))
load.side_effect = se
PluginManager.sync_plugins_metadata(plugin_ids=[plugin.id])
self.assertEqual(plugin.tasks, [])
示例3: test_sync_metadata_for_all_plugins
# 需要导入模块: from nailgun.plugins.manager import PluginManager [as 别名]
# 或者: from nailgun.plugins.manager.PluginManager import sync_plugins_metadata [as 别名]
def test_sync_metadata_for_all_plugins(self, sync_mock):
PluginManager.sync_plugins_metadata()
self.assertEqual(sync_mock.call_count, 2)
示例4: test_sync_metadata_for_specific_plugin
# 需要导入模块: from nailgun.plugins.manager import PluginManager [as 别名]
# 或者: from nailgun.plugins.manager.PluginManager import sync_plugins_metadata [as 别名]
def test_sync_metadata_for_specific_plugin(self, sync_mock):
PluginManager.sync_plugins_metadata([self.env.plugins[0].id])
self.assertEqual(sync_mock.call_count, 1)
示例5: test_sync_metadata_for_all_plugins
# 需要导入模块: from nailgun.plugins.manager import PluginManager [as 别名]
# 或者: from nailgun.plugins.manager.PluginManager import sync_plugins_metadata [as 别名]
def test_sync_metadata_for_all_plugins(self, sync_mock, list_fs_m):
list_fs_m.return_value = ['test_plugin_1-0.1', 'test_plugin_2-0.1']
PluginManager.sync_plugins_metadata()
self.assertEqual(sync_mock.call_count, 2)