summaryrefslogtreecommitdiffstats
path: root/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestCfg/TestCfgAuthorizedKeysGenerator.py
diff options
context:
space:
mode:
authorChris St. Pierre <chris.a.st.pierre@gmail.com>2013-08-08 15:35:23 -0400
committerChris St. Pierre <chris.a.st.pierre@gmail.com>2013-08-09 10:26:31 -0400
commit48dea2ea0ce93b80484abac6875da4fdf5a20ce7 (patch)
treeee90f7fb0c593420a6c87801cd5aa4083a6568a9 /testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestCfg/TestCfgAuthorizedKeysGenerator.py
parentb228b295546aa82d2dfe588e3e52817e392ddb6a (diff)
downloadbcfg2-48dea2ea0ce93b80484abac6875da4fdf5a20ce7.tar.gz
bcfg2-48dea2ea0ce93b80484abac6875da4fdf5a20ce7.tar.bz2
bcfg2-48dea2ea0ce93b80484abac6875da4fdf5a20ce7.zip
testsuite: fixed unit tests for server plugins
Diffstat (limited to 'testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestCfg/TestCfgAuthorizedKeysGenerator.py')
-rw-r--r--testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestCfg/TestCfgAuthorizedKeysGenerator.py28
1 files changed, 5 insertions, 23 deletions
diff --git a/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestCfg/TestCfgAuthorizedKeysGenerator.py b/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestCfg/TestCfgAuthorizedKeysGenerator.py
index b77d52033..e5cef8fa2 100644
--- a/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestCfg/TestCfgAuthorizedKeysGenerator.py
+++ b/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestCfg/TestCfgAuthorizedKeysGenerator.py
@@ -23,6 +23,10 @@ class TestCfgAuthorizedKeysGenerator(TestCfgGenerator, TestStructFile):
test_obj = CfgAuthorizedKeysGenerator
should_monitor = False
+ def setUp(self):
+ TestCfgGenerator.setUp(self)
+ TestStructFile.setUp(self)
+
def get_obj(self, name=None, core=None, fam=None):
if name is None:
name = self.path
@@ -40,31 +44,9 @@ class TestCfgAuthorizedKeysGenerator(TestCfgGenerator, TestStructFile):
mock_HandleEvent.assert_called_with(akg, evt)
mock_handle_event.assert_called_with(akg, evt)
- def test_category(self):
- akg = self.get_obj()
- akg.setup = Mock()
- akg.setup.cfp.has_section.return_value = False
- akg.setup.cfp.has_option.return_value = False
-
- self.assertIsNone(akg.category)
- akg.setup.cfp.has_section.assert_called_with("sshkeys")
-
- akg.setup.reset_mock()
- akg.setup.cfp.has_section.return_value = True
- self.assertIsNone(akg.category)
- akg.setup.cfp.has_section.assert_called_with("sshkeys")
- akg.setup.cfp.has_option.assert_called_with("sshkeys", "category")
-
- akg.setup.reset_mock()
- akg.setup.cfp.has_option.return_value = True
- self.assertEqual(akg.category, akg.setup.cfp.get.return_value)
- akg.setup.cfp.has_section.assert_called_with("sshkeys")
- akg.setup.cfp.has_option.assert_called_with("sshkeys", "category")
- akg.setup.cfp.get.assert_called_with("sshkeys", "category")
-
@patch("Bcfg2.Server.Plugins.Cfg.CfgAuthorizedKeysGenerator.ClientMetadata")
- @patch("Bcfg2.Server.Plugins.Cfg.CfgAuthorizedKeysGenerator.CfgAuthorizedKeysGenerator.category", "category")
def test_get_data(self, mock_ClientMetadata):
+ Bcfg2.Options.setup.sshkeys_category = "category"
akg = self.get_obj()
akg.XMLMatch = Mock()