diff options
-rw-r--r-- | sos/plugins/__init__.py | 2 | ||||
-rw-r--r-- | tests/option_tests.py | 24 |
2 files changed, 25 insertions, 1 deletions
diff --git a/sos/plugins/__init__.py b/sos/plugins/__init__.py index ebb76ea3..872e684d 100644 --- a/sos/plugins/__init__.py +++ b/sos/plugins/__init__.py @@ -299,7 +299,7 @@ class Plugin(object): any of the option names is returned.""" def _check(key): - if hasattr(key, "__iter__"): + if hasattr(optionname, "__iter__"): return key in optionname else: return key == optionname diff --git a/tests/option_tests.py b/tests/option_tests.py new file mode 100644 index 00000000..06f048a4 --- /dev/null +++ b/tests/option_tests.py @@ -0,0 +1,24 @@ +#!/usr/bin/env python + +import unittest + +from sos.plugins import Plugin + +class GlobalOptionTest(unittest.TestCase): + + def setUp(self): + self.commons = { + 'global_plugin_options': { + 'test_option': 'foobar', + }, + } + self.plugin = Plugin(self.commons) + + def test_simple_lookup(self): + self.assertEquals(self.plugin.getOption('test_option'), 'foobar') + + def test_multi_lookup(self): + self.assertEquals(self.plugin.getOption(('not_there', 'test_option')), 'foobar') + +if __name__ == "__main__": + unittest.main() |