mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-02 01:18:26 +03:00
lvmdbustest.py: Make methods static
Changed methods to be static that should be.
This commit is contained in:
parent
ac2fc7a366
commit
65f59184c8
@ -141,7 +141,8 @@ class TestDbusService(unittest.TestCase):
|
|||||||
vg.Remove(-1, {})
|
vg.Remove(-1, {})
|
||||||
self.assertEqual(self._refresh(), 0)
|
self.assertEqual(self._refresh(), 0)
|
||||||
|
|
||||||
def _pv_remove(self, pv):
|
@staticmethod
|
||||||
|
def _pv_remove(pv):
|
||||||
rc = pv.Pv.Remove(-1, {})
|
rc = pv.Pv.Remove(-1, {})
|
||||||
return rc
|
return rc
|
||||||
|
|
||||||
@ -149,7 +150,7 @@ class TestDbusService(unittest.TestCase):
|
|||||||
target = self.objs[PV_INT][0]
|
target = self.objs[PV_INT][0]
|
||||||
|
|
||||||
# Remove the PV
|
# Remove the PV
|
||||||
rc = self._pv_remove(target)
|
rc = TestDbusService._pv_remove(target)
|
||||||
self.assertTrue(rc == '/')
|
self.assertTrue(rc == '/')
|
||||||
self.assertEqual(self._refresh(), 0)
|
self.assertEqual(self._refresh(), 0)
|
||||||
|
|
||||||
@ -926,12 +927,13 @@ class TestDbusService(unittest.TestCase):
|
|||||||
|
|
||||||
self.assertEqual(self._refresh(), 0)
|
self.assertEqual(self._refresh(), 0)
|
||||||
|
|
||||||
def _get_devices(self):
|
@staticmethod
|
||||||
|
def _get_devices():
|
||||||
context = pyudev.Context()
|
context = pyudev.Context()
|
||||||
return context.list_devices(subsystem='block', MAJOR='8')
|
return context.list_devices(subsystem='block', MAJOR='8')
|
||||||
|
|
||||||
def test_pv_scan(self):
|
def test_pv_scan(self):
|
||||||
devices = self._get_devices()
|
devices = TestDbusService._get_devices()
|
||||||
|
|
||||||
mgr = self._manager().Manager
|
mgr = self._manager().Manager
|
||||||
|
|
||||||
@ -1068,7 +1070,8 @@ class TestDbusService(unittest.TestCase):
|
|||||||
result = vg_proxy.Vg.Change(-1, {'-a': 'n'})
|
result = vg_proxy.Vg.Change(-1, {'-a': 'n'})
|
||||||
self.assertTrue(result == '/')
|
self.assertTrue(result == '/')
|
||||||
|
|
||||||
def _invalid_vg_lv_name_characters(self):
|
@staticmethod
|
||||||
|
def _invalid_vg_lv_name_characters():
|
||||||
bad_vg_lv_set = set(string.printable) - \
|
bad_vg_lv_set = set(string.printable) - \
|
||||||
set(string.ascii_letters + string.digits + '.-_+')
|
set(string.ascii_letters + string.digits + '.-_+')
|
||||||
return ''.join(bad_vg_lv_set)
|
return ''.join(bad_vg_lv_set)
|
||||||
@ -1083,7 +1086,7 @@ class TestDbusService(unittest.TestCase):
|
|||||||
# VG Name testing...
|
# VG Name testing...
|
||||||
# Go through all bad characters
|
# Go through all bad characters
|
||||||
pv_paths = [self.objs[PV_INT][0].object_path]
|
pv_paths = [self.objs[PV_INT][0].object_path]
|
||||||
bad_chars = self._invalid_vg_lv_name_characters()
|
bad_chars = TestDbusService._invalid_vg_lv_name_characters()
|
||||||
for c in bad_chars:
|
for c in bad_chars:
|
||||||
with self.assertRaises(dbus.exceptions.DBusException):
|
with self.assertRaises(dbus.exceptions.DBusException):
|
||||||
mgr.VgCreate("name%s" % (c), pv_paths, -1, {})
|
mgr.VgCreate("name%s" % (c), pv_paths, -1, {})
|
||||||
|
Loading…
Reference in New Issue
Block a user