summaryrefslogtreecommitdiffstats
path: root/testsuite/Testlib/TestClient/TestTools/TestPOSIX/TestDevice.py
diff options
context:
space:
mode:
authorChris St. Pierre <chris.a.st.pierre@gmail.com>2012-08-16 09:55:53 -0400
committerChris St. Pierre <chris.a.st.pierre@gmail.com>2012-08-16 09:55:53 -0400
commit6de50a235ed21de987488a2890b13f029d1962b4 (patch)
treeee540c156370cb4dd00b1d54f4bdeb6e42fd47cc /testsuite/Testlib/TestClient/TestTools/TestPOSIX/TestDevice.py
parentad0798f9e7fe105fa1314daf0213d8d3d50bd2e1 (diff)
downloadbcfg2-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/TestDevice.py')
-rw-r--r--testsuite/Testlib/TestClient/TestTools/TestPOSIX/TestDevice.py16
1 files changed, 7 insertions, 9 deletions
diff --git a/testsuite/Testlib/TestClient/TestTools/TestPOSIX/TestDevice.py b/testsuite/Testlib/TestClient/TestTools/TestPOSIX/TestDevice.py
index ba25c9bea..f32da9c37 100644
--- a/testsuite/Testlib/TestClient/TestTools/TestPOSIX/TestDevice.py
+++ b/testsuite/Testlib/TestClient/TestTools/TestPOSIX/TestDevice.py
@@ -5,16 +5,14 @@ import lxml.etree
from mock import Mock, MagicMock, patch
from Bcfg2.Client.Tools.POSIX.Device import *
from Test__init import get_posix_object
+from Testbase import TestPOSIXTool
from .....common import *
-def get_device_object(posix=None):
- if posix is None:
- posix = get_posix_object()
- return POSIXDevice(posix.logger, posix.setup, posix.config)
+class TestPOSIXDevice(TestPOSIXTool):
+ test_obj = POSIXDevice
-class TestPOSIXDevice(Bcfg2TestCase):
def test_fully_specified(self):
- ptool = get_device_object()
+ ptool = self.get_obj()
orig_entry = lxml.etree.Element("Path", name="/test", type="device",
dev_type="fifo")
self.assertTrue(ptool.fully_specified(orig_entry))
@@ -38,7 +36,7 @@ class TestPOSIXDevice(Bcfg2TestCase):
entry = lxml.etree.Element("Path", name="/test", type="device",
perms='0644', owner='root', group='root',
dev_type="block", major="0", minor="10")
- ptool = get_device_object()
+ ptool = self.get_obj()
def reset():
mock_exists.reset_mock()
@@ -85,13 +83,13 @@ class TestPOSIXDevice(Bcfg2TestCase):
@patch("os.makedev")
@patch("os.mknod")
- @patch("Bcfg2.Client.Tools.POSIX.Device.POSIXDevice._exists")
+ @patch("Bcfg2.Client.Tools.POSIX.Device.%s._exists" % test_obj.__name__)
@patch("Bcfg2.Client.Tools.POSIX.base.POSIXTool.install")
def test_install(self, mock_install, mock_exists, mock_mknod, mock_makedev):
entry = lxml.etree.Element("Path", name="/test", type="device",
perms='0644', owner='root', group='root',
dev_type="block", major="0", minor="10")
- ptool = get_device_object()
+ ptool = self.get_obj()
mock_exists.return_value = False
mock_makedev.return_value = Mock()