From ecb501b84338f078be18c38c68c3ce87fed3584b Mon Sep 17 00:00:00 2001 From: Xiaofeng Wang Date: Thu, 17 Oct 2019 15:18:44 +0000 Subject: guestcust_util: handle special characters in config file Handle the special characters when reading VM Tools configure file. For example, the key and value may contain _, - and . etc. --- tests/unittests/test_vmware/test_guestcust_util.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'tests/unittests/test_vmware') diff --git a/tests/unittests/test_vmware/test_guestcust_util.py b/tests/unittests/test_vmware/test_guestcust_util.py index b8fa9942..b175a998 100644 --- a/tests/unittests/test_vmware/test_guestcust_util.py +++ b/tests/unittests/test_vmware/test_guestcust_util.py @@ -62,4 +62,11 @@ class TestGuestCustUtil(CiTestCase): get_tools_config('section', 'key', 'defaultVal'), 'Bar=Wark') + # value contains specific characters + with mock.patch.object(util, 'subp', + return_value=('[a] b.c_d=e-f', b'')): + self.assertEqual( + get_tools_config('section', 'key', 'defaultVal'), + 'e-f') + # vi: ts=4 expandtab -- cgit v1.2.3