From 916bec859cfa0a0df879b2674527bce9c0926a46 Mon Sep 17 00:00:00 2001 From: Ian Cordasco Date: Thu, 21 Jan 2016 08:32:35 -0600 Subject: [PATCH] Finish testing PluginManager --- tests/unit/test_plugin_manager.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/tests/unit/test_plugin_manager.py b/tests/unit/test_plugin_manager.py index 022848f..05073cf 100644 --- a/tests/unit/test_plugin_manager.py +++ b/tests/unit/test_plugin_manager.py @@ -50,7 +50,7 @@ def test_proxies_contains_to_plugins_dictionary(iter_entry_points): @mock.patch('pkg_resources.iter_entry_points') -def test_proxies_getitm_to_plugins_dictionary(iter_entry_points): +def test_proxies_getitem_to_plugins_dictionary(iter_entry_points): """Verify that we can use the PluginManager like a dictionary.""" iter_entry_points.return_value = [ create_entry_point_mock('T100'), @@ -60,3 +60,17 @@ def test_proxies_getitm_to_plugins_dictionary(iter_entry_points): assert isinstance(plugin_mgr['T100'], manager.Plugin) assert isinstance(plugin_mgr['T200'], manager.Plugin) + + +@mock.patch('pkg_resources.iter_entry_points') +def test_handles_mapping_functions_across_plugins(iter_entry_points): + """Verify we can use the PluginManager call functions on all plugins.""" + entry_point_mocks = [ + create_entry_point_mock('T100'), + create_entry_point_mock('T200'), + ] + iter_entry_points.return_value = entry_point_mocks + plugin_mgr = manager.PluginManager(namespace='testing.pkg_resources') + plugins = [plugin_mgr[name] for name in plugin_mgr.names] + + assert list(plugin_mgr.map(lambda x: x)) == plugins