Skip to content

Commit

Permalink
Fix one UT to make it py2 compatible
Browse files Browse the repository at this point in the history
  • Loading branch information
arbulu89 committed Mar 5, 2020
1 parent 4990400 commit eef7159
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion tests/unit/states/test_crmshmod.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
# Import Python libs
from __future__ import absolute_import, unicode_literals, print_function

import sys
from salt import exceptions

# Import Salt Testing Libs
Expand Down Expand Up @@ -646,7 +647,13 @@ def test_convert2corosync(self):
}

output = crmshmod._convert2corosync(main_dict, '')
assert output == "a {\n\tb {\n\t\tf: 7\n\t}\n\tc: 2\n}\nd: 3\n"

# Py2 and py3 have different way of ordering the `items` method
# For the functionality this does not really affect
if sys.version_info[0] == 2:
assert output == "a {\n\tc: 2\n\tb {\n\t\tf: 7\n\t}\n}\nd: 3\n"
else:
assert output == "a {\n\tb {\n\t\tf: 7\n\t}\n\tc: 2\n}\nd: 3\n"

@mock.patch('salt.states.crmshmod._convert2dict')
@mock.patch('salt.states.crmshmod._mergedicts')
Expand Down

0 comments on commit eef7159

Please sign in to comment.