Fix test_keys_and_vals_to_strs dict assert
Fix the assert of dictionary equality in test_keys_and_vals_to_strs as the dictionary order can cause the test to fail. Change-Id: Iaa0c7bf6cbcb456451d287c7ba8d9e2829e4edc5 Closes-Bug: #1532834
This commit is contained in:
parent
e9452a6e7c
commit
c0a6829c15
@ -15,6 +15,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import collections
|
||||
import six
|
||||
|
||||
from magnumclient.common import utils
|
||||
@ -181,6 +182,16 @@ class CliUtilsTest(test_utils.BaseTestCase):
|
||||
|
||||
def test_keys_and_vals_to_strs(self):
|
||||
dict_in = {u'a': u'1', u'b': {u'x': 1, 'y': u'2', u'z': u'3'}, 'c': 7}
|
||||
dict_exp = {'a': '1', 'b': {'x': 1, 'y': '2', 'z': '3'}, 'c': 7}
|
||||
|
||||
dict_exp = collections.OrderedDict(
|
||||
{'a': '1',
|
||||
'b': collections.OrderedDict({'x': 1, 'y': '2', 'z': '3'}),
|
||||
'c': 7})
|
||||
|
||||
dict_out = cliutils.keys_and_vals_to_strs(dict_in)
|
||||
self.assertEqual(six.text_type(dict_exp), six.text_type(dict_out))
|
||||
dict_act = collections.OrderedDict(
|
||||
{'a': dict_out['a'],
|
||||
'b': collections.OrderedDict(dict_out['b']),
|
||||
'c': dict_out['c']})
|
||||
|
||||
self.assertEqual(six.text_type(dict_exp), six.text_type(dict_act))
|
||||
|
Loading…
Reference in New Issue
Block a user