Exemple #1
0
 def test_bad_get_north_plugin_config(self, exc_name, log_exc_name, msg):
     with patch.object(_logger, log_exc_name) as patch_log_exc:
         with patch.object(common, 'load_and_fetch_python_plugin_info', side_effect=[exc_name]):
             PluginDiscovery.get_plugin_config("http", "north", False)
     assert 1 == patch_log_exc.call_count
     args, kwargs = patch_log_exc.call_args
     assert msg in args[0]
Exemple #2
0
 def test_deprecated_python_plugins(self, info, warn_count, is_config=True):
     with patch.object(_logger, "warning") as patch_log_warn:
         with patch.object(common, 'load_and_fetch_python_plugin_info', side_effect=[info]):
             PluginDiscovery.get_plugin_config(info['name'], info['type'], is_config)
     assert warn_count == patch_log_warn.call_count
     if warn_count:
         args, kwargs = patch_log_warn.call_args
         assert '"{}" plugin is deprecated'.format(info['name']) == args[0]
Exemple #3
0
 def test_get_plugin_config(self, info, expected, is_config):
     with patch.object(common,
                       'load_and_fetch_python_plugin_info',
                       side_effect=[info]):
         actual = PluginDiscovery.get_plugin_config("modbus", "south",
                                                    is_config)
         assert expected == actual
Exemple #4
0
 def test_bad_get_plugin_config(self):
     mock_plugin_info = {
             'name': "HTTP",
             'version': "1.0.0",
             'type': "north",
             'interface': "1.0.0",
             'config': {
                         'plugin': {
                             'description': "HTTP north plugin",
                             'type': 'string',
                             'default': 'http-north'
                         }
             }
     }
     with patch.object(_logger, "warning") as patch_log_warn:
         with patch.object(common, 'load_and_fetch_python_plugin_info', side_effect=[mock_plugin_info]):
             actual = PluginDiscovery.get_plugin_config("http-north", "south", False)
             assert actual is None
     patch_log_warn.assert_called_once_with('Plugin http-north is discarded due to invalid type')