From: Tony Asleson Date: Thu, 3 Oct 2019 20:05:37 +0000 (-0500) Subject: lvmdbusdtest.py: Use common function for tag add X-Git-Tag: v2_03_07~108 X-Git-Url: https://sourceware.org/git/?a=commitdiff_plain;h=22a22a735fef7bcd0f1acc80e99f500925e3572c;p=lvm2.git lvmdbusdtest.py: Use common function for tag add --- diff --git a/test/dbus/lvmdbustest.py b/test/dbus/lvmdbustest.py index da1fc69dc..0384d5e1b 100755 --- a/test/dbus/lvmdbustest.py +++ b/test/dbus/lvmdbustest.py @@ -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)