Commit 1d5b167c authored by Łukasz Nowak's avatar Łukasz Nowak

squash! Synchronise xml2dict and dict2xml

Stabilise generated XMLs by sorting the dictionary.
parent 7cc4d3ba
......@@ -123,14 +123,14 @@ class TestUtil(unittest.TestCase):
xml2dict_xml = slapos.util.bytes2str(b"""<?xml version='1.0' encoding='utf-8'?>
<instance>
<parameter id="badstr">\xc5\x81</parameter>
<parameter id="badu">\xc5\x81</parameter>
<parameter id="emptystr"></parameter>
<parameter id="int">1</parameter>
<parameter id="intstr">1</parameter>
<parameter id="key">str</parameter>
<parameter id="ukey">ustr</parameter>
<parameter id="int">1</parameter>
<parameter id="list">[\'one\', 2]</parameter>
<parameter id="emptystr"></parameter>
<parameter id="none">None</parameter>
<parameter id="badu">\xc5\x81</parameter>
<parameter id="ukey">ustr</parameter>
</instance>
""")
......
......@@ -153,7 +153,7 @@ else:
def dict2xml(dictionary):
instance = etree.Element('instance')
for k, v in six.iteritems(dictionary):
for k, v in sorted(six.iteritems(dictionary)):
if isinstance(k, bytes):
k = k.decode('utf-8')
if isinstance(v, bytes):
......
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