Back to index

python-cliapp  1.20120630
Public Member Functions | Public Attributes
cliapp.pluginmgr_tests.PluginManagerTests Class Reference

List of all members.

Public Member Functions

def setUp
def test_finds_the_right_plugin_files
def test_plugin_files_attribute_implicitly_searches
def test_loads_hello_plugin
def test_plugins_attribute_implicitly_searches
def test_initializes_hello_with_correct_args
def test_raises_keyerror_for_unknown_plugin
def test_enable_plugins_enables_all_plugins
def test_disable_plugins_disables_all_plugins

Public Attributes

 pm
 files

Detailed Description

Definition at line 47 of file pluginmgr_tests.py.


Member Function Documentation

Definition at line 49 of file pluginmgr_tests.py.

00049 
00050     def setUp(self):
00051         self.pm = PluginManager()
00052         self.pm.locations = ['test-plugins', 'not-exist']
00053         self.pm.plugin_arguments = ('fooarg',)
00054         self.pm.plugin_keyword_arguments = { 'bar': 'bararg' }
00055         
00056         self.files = sorted(['test-plugins/hello_plugin.py',
00057                              'test-plugins/aaa_hello_plugin.py',
00058                              'test-plugins/oldhello_plugin.py',
00059                              'test-plugins/wrongversion_plugin.py'])

Definition at line 90 of file pluginmgr_tests.py.

00090 
00091     def test_disable_plugins_disables_all_plugins(self):
00092         disabled = set()
00093         for plugin in self.pm.plugins:
00094             plugin.disable = lambda: disabled.add(plugin)
00095         self.pm.disable_plugins()
00096         self.assertEqual(disabled, set(self.pm.plugins))
00097 

Definition at line 83 of file pluginmgr_tests.py.

00083 
00084     def test_enable_plugins_enables_all_plugins(self):
00085         enabled = set()
00086         for plugin in self.pm.plugins:
00087             plugin.enable = lambda: enabled.add(plugin)
00088         self.pm.enable_plugins()
00089         self.assertEqual(enabled, set(self.pm.plugins))

Definition at line 60 of file pluginmgr_tests.py.

00060 
00061     def test_finds_the_right_plugin_files(self):
00062         self.assertEqual(self.pm.find_plugin_files(), self.files)

Definition at line 75 of file pluginmgr_tests.py.

00075 
00076     def test_initializes_hello_with_correct_args(self):
00077         plugin = self.pm['Hello']
00078         self.assertEqual(plugin.foo, 'fooarg')
00079         self.assertEqual(plugin.bar, 'bararg')

Definition at line 66 of file pluginmgr_tests.py.

00066 
00067     def test_loads_hello_plugin(self):
00068         plugins = self.pm.load_plugins()
00069         self.assertEqual(len(plugins), 1)
00070         self.assertEqual(plugins[0].name, 'Hello')

Definition at line 63 of file pluginmgr_tests.py.

00063 
00064     def test_plugin_files_attribute_implicitly_searches(self):
00065         self.assertEqual(self.pm.plugin_files, self.files)

Definition at line 71 of file pluginmgr_tests.py.

00071 
00072     def test_plugins_attribute_implicitly_searches(self):
00073         self.assertEqual(len(self.pm.plugins), 1)
00074         self.assertEqual(self.pm.plugins[0].name, 'Hello')

Definition at line 80 of file pluginmgr_tests.py.

00080 
00081     def test_raises_keyerror_for_unknown_plugin(self):
00082         self.assertRaises(KeyError, self.pm.__getitem__, 'Hithere')


Member Data Documentation

Definition at line 55 of file pluginmgr_tests.py.

Definition at line 50 of file pluginmgr_tests.py.


The documentation for this class was generated from the following file: