]> sourceware.org Git - lvm2.git/commitdiff
lvmdbusdtest.py: Use common function for tag add
authorTony Asleson <tasleson@redhat.com>
Thu, 3 Oct 2019 20:05:37 +0000 (15:05 -0500)
committerTony Asleson <tasleson@redhat.com>
Wed, 30 Oct 2019 15:38:40 +0000 (10:38 -0500)
test/dbus/lvmdbustest.py

index da1fc69dc6874de7655a7b5eebb29e346c5f8cd6..0384d5e1b074dfb67276850f545f2a1a3c62e4c3 100755 (executable)
@@ -1715,23 +1715,25 @@ class TestDbusService(unittest.TestCase):
                                                dbus.Int32(g_tmo),
                                                EOD))
 
+       def _tag_add_common(self, vg_proxy, tag):
+               tmp = self.handle_return(
+                       vg_proxy.Vg.TagsAdd(
+                               dbus.Array([tag], 's'),
+                               dbus.Int32(g_tmo),
+                               EOD))
+               self.assertTrue(tmp == '/')
+               vg_proxy.update()
+
+               self.assertTrue(
+                       tag in vg_proxy.Vg.Tags,
+                       "%s not in %s" % (tag, str(vg_proxy.Vg.Tags)))
+
        def test_tag_names(self):
                vg_proxy = self._vg_create()
 
                for i in range(1, 64):
                        tag = rs(i, "", self._ALLOWABLE_TAG_CH)
-
-                       tmp = self.handle_return(
-                               vg_proxy.Vg.TagsAdd(
-                                       dbus.Array([tag], 's'),
-                                       dbus.Int32(g_tmo),
-                                       EOD))
-                       self.assertTrue(tmp == '/')
-                       vg_proxy.update()
-
-                       self.assertTrue(
-                               tag in vg_proxy.Vg.Tags,
-                               "%s not in %s" % (tag, str(vg_proxy.Vg.Tags)))
+                       self._tag_add_common(vg_proxy, tag)
 
                        self.assertEqual(
                                i, len(vg_proxy.Vg.Tags),
@@ -1739,20 +1741,8 @@ class TestDbusService(unittest.TestCase):
 
        def test_tag_regression(self):
                vg_proxy = self._vg_create()
-
                tag = '--h/K.6g0A4FOEatf3+k_nI/Yp&L_u2oy-=j649x:+dUcYWPEo6.IWT0c'
-
-               tmp = self.handle_return(
-                       vg_proxy.Vg.TagsAdd(
-                               dbus.Array([tag], 's'),
-                               dbus.Int32(g_tmo),
-                               EOD))
-               self.assertTrue(tmp == '/')
-               vg_proxy.update()
-
-               self.assertTrue(
-                       tag in vg_proxy.Vg.Tags,
-                       "%s not in %s" % (tag, str(vg_proxy.Vg.Tags)))
+               self._tag_add_common(vg_proxy, tag)
 
        def _verify_existence(self, cmd, operation, resource_name):
                ec, stdout, stderr = call_lvm(cmd)
This page took 0.036689 seconds and 5 git commands to generate.