Back to index

obnam  1.1
Public Member Functions | Public Attributes
obnamlib.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 80 of file pluginmgr_tests.py.


Member Function Documentation

Definition at line 82 of file pluginmgr_tests.py.

00082 
00083     def setUp(self):
00084         self.pm = PluginManager()
00085         self.pm.locations = ['test-plugins', 'not-exist']
00086         self.pm.plugin_arguments = ('fooarg',)
00087         self.pm.plugin_keyword_arguments = { 'bar': 'bararg' }
00088         
00089         self.files = sorted(['test-plugins/hello_plugin.py',
00090                              'test-plugins/aaa_hello_plugin.py',
00091                              'test-plugins/oldhello_plugin.py',
00092                              'test-plugins/wrongversion_plugin.py'])

Definition at line 123 of file pluginmgr_tests.py.

00123 
00124     def test_disable_plugins_disables_all_plugins(self):
00125         disabled = set()
00126         for plugin in self.pm.plugins:
00127             plugin.disable = lambda: disabled.add(plugin)
00128         self.pm.disable_plugins()
00129         self.assertEqual(disabled, set(self.pm.plugins))
00130 

Definition at line 116 of file pluginmgr_tests.py.

00116 
00117     def test_enable_plugins_enables_all_plugins(self):
00118         enabled = set()
00119         for plugin in self.pm.plugins:
00120             plugin.enable = lambda: enabled.add(plugin)
00121         self.pm.enable_plugins()
00122         self.assertEqual(enabled, set(self.pm.plugins))

Definition at line 93 of file pluginmgr_tests.py.

00093 
00094     def test_finds_the_right_plugin_files(self):
00095         self.assertEqual(self.pm.find_plugin_files(), self.files)

Definition at line 108 of file pluginmgr_tests.py.

00108 
00109     def test_initializes_hello_with_correct_args(self):
00110         plugin = self.pm['Hello']
00111         self.assertEqual(plugin.foo, 'fooarg')
00112         self.assertEqual(plugin.bar, 'bararg')

Definition at line 99 of file pluginmgr_tests.py.

00099 
00100     def test_loads_hello_plugin(self):
00101         plugins = self.pm.load_plugins()
00102         self.assertEqual(len(plugins), 1)
00103         self.assertEqual(plugins[0].name, 'Hello')

Definition at line 96 of file pluginmgr_tests.py.

00096 
00097     def test_plugin_files_attribute_implicitly_searches(self):
00098         self.assertEqual(self.pm.plugin_files, self.files)

Definition at line 104 of file pluginmgr_tests.py.

00104 
00105     def test_plugins_attribute_implicitly_searches(self):
00106         self.assertEqual(len(self.pm.plugins), 1)
00107         self.assertEqual(self.pm.plugins[0].name, 'Hello')

Definition at line 113 of file pluginmgr_tests.py.

00113 
00114     def test_raises_keyerror_for_unknown_plugin(self):
00115         self.assertRaises(KeyError, self.pm.__getitem__, 'Hithere')


Member Data Documentation

Definition at line 88 of file pluginmgr_tests.py.

Definition at line 83 of file pluginmgr_tests.py.


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