diff options
author | Chris St. Pierre <chris.a.st.pierre@gmail.com> | 2013-02-20 10:38:38 -0500 |
---|---|---|
committer | Chris St. Pierre <chris.a.st.pierre@gmail.com> | 2013-02-20 10:38:38 -0500 |
commit | 69ebf49d54aac70a42142d0d04e562496bce58ea (patch) | |
tree | ad0f346ff95a14ad49440128ff76d7e2b3f0816a /testsuite/Testsrc/Testlib/TestClient/TestTools/TestPOSIX/TestHardlink.py | |
parent | 602ba6af6bd1c9b3910940dee766660ab8e81a19 (diff) | |
parent | e17e41dcff096ead7e129a0db063f75de44aaa2b (diff) | |
download | bcfg2-69ebf49d54aac70a42142d0d04e562496bce58ea.tar.gz bcfg2-69ebf49d54aac70a42142d0d04e562496bce58ea.tar.bz2 bcfg2-69ebf49d54aac70a42142d0d04e562496bce58ea.zip |
Merge branch 'master' into 1.4.x
Conflicts:
doc/appendix/contributors.txt
schemas/bundle.xsd
src/lib/Bcfg2/Client/Tools/__init__.py
src/lib/Bcfg2/Server/Encryption.py
src/lib/Bcfg2/Server/Lint/Genshi.py
src/lib/Bcfg2/Server/Plugins/Bundler.py
src/lib/Bcfg2/Server/Plugins/Decisions.py
src/lib/Bcfg2/Server/Plugins/TemplateHelper.py
src/sbin/bcfg2-test
testsuite/Testsrc/Testlib/TestClient/TestTools/TestPOSIX/Test__init.py
testsuite/Testsrc/Testlib/TestClient/TestTools/TestPOSIXUsers.py
testsuite/Testsrc/Testlib/TestServer/TestPlugin/Testhelpers.py
testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestProperties.py
tools/bcfg2-profile-templates.py
Diffstat (limited to 'testsuite/Testsrc/Testlib/TestClient/TestTools/TestPOSIX/TestHardlink.py')
-rw-r--r-- | testsuite/Testsrc/Testlib/TestClient/TestTools/TestPOSIX/TestHardlink.py | 62 |
1 files changed, 9 insertions, 53 deletions
diff --git a/testsuite/Testsrc/Testlib/TestClient/TestTools/TestPOSIX/TestHardlink.py b/testsuite/Testsrc/Testlib/TestClient/TestTools/TestPOSIX/TestHardlink.py index c38e86aeb..3159b69df 100644 --- a/testsuite/Testsrc/Testlib/TestClient/TestTools/TestPOSIX/TestHardlink.py +++ b/testsuite/Testsrc/Testlib/TestClient/TestTools/TestPOSIX/TestHardlink.py @@ -14,70 +14,26 @@ while path != "/": if os.path.basename(path) == "testsuite": break path = os.path.dirname(path) -from Test__init import get_posix_object -from Testbase import TestPOSIXTool +from Testbase import TestPOSIXLinkTool from common import * -class TestPOSIXHardlink(TestPOSIXTool): + +class TestPOSIXHardlink(TestPOSIXLinkTool): test_obj = POSIXHardlink @patch("os.path.samefile") - @patch("Bcfg2.Client.Tools.POSIX.base.POSIXTool.verify") - def test_verify(self, mock_verify, mock_samefile): + def test__verify(self, mock_samefile): entry = lxml.etree.Element("Path", name="/test", type="hardlink", to="/dest") ptool = self.get_obj() - - mock_samefile.return_value = True - mock_verify.return_value = False - self.assertFalse(ptool.verify(entry, [])) - mock_samefile.assert_called_with(entry.get("name"), - entry.get("to")) - mock_verify.assert_called_with(ptool, entry, []) - - mock_samefile.reset_mock() - mock_verify.reset_mock() - mock_verify.return_value = True - self.assertTrue(ptool.verify(entry, [])) - mock_samefile.assert_called_with(entry.get("name"), - entry.get("to")) - mock_verify.assert_called_with(ptool, entry, []) - - mock_samefile.reset_mock() - mock_verify.reset_mock() - mock_samefile.return_value = False - self.assertFalse(ptool.verify(entry, [])) - mock_samefile.assert_called_with(entry.get("name"), - entry.get("to")) - mock_verify.assert_called_with(ptool, entry, []) - - mock_samefile.reset_mock() - mock_verify.reset_mock() - mock_samefile.side_effect = OSError - self.assertFalse(ptool.verify(entry, [])) - mock_samefile.assert_called_with(entry.get("name"), - entry.get("to")) + self.assertEqual(ptool._verify(entry), mock_samefile.return_value) + self.assertItemsEqual(mock_samefile.call_args[0], + [entry.get("name"), entry.get("to")]) @patch("os.link") - @patch("Bcfg2.Client.Tools.POSIX.base.POSIXTool.install") - @patch("Bcfg2.Client.Tools.POSIX.Hardlink.%s._exists" % test_obj.__name__) - def test_install(self, mock_exists, mock_install, mock_link): + def test__link(self, mock_link): entry = lxml.etree.Element("Path", name="/test", type="hardlink", to="/dest") ptool = self.get_obj() - - mock_exists.return_value = False - mock_install.return_value = True - self.assertTrue(ptool.install(entry)) - mock_exists.assert_called_with(entry, remove=True) - mock_link.assert_called_with(entry.get("to"), entry.get("name")) - mock_install.assert_called_with(ptool, entry) - - mock_link.reset_mock() - mock_exists.reset_mock() - mock_install.reset_mock() - mock_link.side_effect = OSError - self.assertFalse(ptool.install(entry)) - mock_exists.assert_called_with(entry, remove=True) + self.assertEqual(ptool._link(entry), mock_link.return_value) mock_link.assert_called_with(entry.get("to"), entry.get("name")) - mock_install.assert_called_with(ptool, entry) |