Commit 4f31882e authored by Guido Trotter's avatar Guido Trotter
Browse files

_SplitKeyVal with no data return an empty dict

If an empty string is passed to _SplitKeyVal, we should return {},
rather than {'': True}. Also test for the correct behavior.
Signed-off-by: default avatarGuido Trotter <>
Reviewed-by: default avatarIustin Pop <>
parent d1a7d66f
......@@ -259,6 +259,7 @@ def _SplitKeyVal(opt, data):
NO_PREFIX = "no_"
kv_dict = {}
if data:
for elem in data.split(","):
if "=" in elem:
key, val = elem.split("=", 1)
......@@ -75,6 +75,10 @@ class TestSplitKeyVal(unittest.TestCase):
self.failUnlessRaises(ParameterError, cli._SplitKeyVal,
"option", data)
def testEmptyData(self):
"""Test how we handle splitting an empty string"""
self.failUnlessEqual(cli._SplitKeyVal("option", ""), {})
class TestToStream(unittest.TestCase):
"""Thes the ToStream functions"""
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment