diff options
author | Chris St. Pierre <chris.a.st.pierre@gmail.com> | 2012-08-16 09:55:53 -0400 |
---|---|---|
committer | Chris St. Pierre <chris.a.st.pierre@gmail.com> | 2012-08-16 09:55:53 -0400 |
commit | 6de50a235ed21de987488a2890b13f029d1962b4 (patch) | |
tree | ee540c156370cb4dd00b1d54f4bdeb6e42fd47cc /testsuite/Testlib/TestClient/TestTools/TestPOSIX/TestDirectory.py | |
parent | ad0798f9e7fe105fa1314daf0213d8d3d50bd2e1 (diff) | |
download | bcfg2-6de50a235ed21de987488a2890b13f029d1962b4.tar.gz bcfg2-6de50a235ed21de987488a2890b13f029d1962b4.tar.bz2 bcfg2-6de50a235ed21de987488a2890b13f029d1962b4.zip |
made POSIX subtool tests inherit from base POSIX tool tests
Diffstat (limited to 'testsuite/Testlib/TestClient/TestTools/TestPOSIX/TestDirectory.py')
-rw-r--r-- | testsuite/Testlib/TestClient/TestTools/TestPOSIX/TestDirectory.py | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/testsuite/Testlib/TestClient/TestTools/TestPOSIX/TestDirectory.py b/testsuite/Testlib/TestClient/TestTools/TestPOSIX/TestDirectory.py index 41e1a3f00..34c98fa9c 100644 --- a/testsuite/Testlib/TestClient/TestTools/TestPOSIX/TestDirectory.py +++ b/testsuite/Testlib/TestClient/TestTools/TestPOSIX/TestDirectory.py @@ -6,20 +6,18 @@ import lxml.etree from mock import Mock, MagicMock, patch from Bcfg2.Client.Tools.POSIX.Directory import * from Test__init import get_posix_object +from Testbase import TestPOSIXTool from .....common import * -def get_directory_object(posix=None): - if posix is None: - posix = get_posix_object() - return POSIXDirectory(posix.logger, posix.setup, posix.config) +class TestPOSIXDirectory(TestPOSIXTool): + test_obj = POSIXDirectory -class TestPOSIXDirectory(Bcfg2TestCase): @patch("Bcfg2.Client.Tools.POSIX.base.POSIXTool.verify") - @patch("Bcfg2.Client.Tools.POSIX.Directory.POSIXDirectory._exists") + @patch("Bcfg2.Client.Tools.POSIX.Directory.%s._exists" % test_obj.__name__) def test_verify(self, mock_exists, mock_verify): entry = lxml.etree.Element("Path", name="/test", type="directory", perms='0644', owner='root', group='root') - ptool = get_directory_object() + ptool = self.get_obj() mock_exists.return_value = False self.assertFalse(ptool.verify(entry, [])) @@ -80,14 +78,15 @@ class TestPOSIXDirectory(Bcfg2TestCase): @patch("os.unlink") @patch("shutil.rmtree") @patch("Bcfg2.Client.Tools.POSIX.base.POSIXTool.install") - @patch("Bcfg2.Client.Tools.POSIX.Directory.POSIXDirectory._exists") - @patch("Bcfg2.Client.Tools.POSIX.Directory.POSIXDirectory._makedirs") + @patch("Bcfg2.Client.Tools.POSIX.Directory.%s._exists" % test_obj.__name__) + @patch("Bcfg2.Client.Tools.POSIX.Directory.%s._makedirs" % + test_obj.__name__) def test_install(self, mock_makedirs, mock_exists, mock_install, mock_rmtree, mock_unlink): entry = lxml.etree.Element("Path", name="/test/foo/bar", type="directory", perms='0644', owner='root', group='root') - ptool = get_directory_object() + ptool = self.get_obj() def reset(): mock_exists.reset_mock() |