salt/tests/unit/utils/test_iam.py
Erik Johnson c57b5a5502
Fix breakage in salt.utils.iam
This fixes breakage introduced in
https://github.com/saltstack/salt/pull/45406 and adds a unit test.
2018-01-13 15:04:18 -06:00

23 lines
601 B
Python

# -*- coding: utf-8 -*-
'''
Tests for salt.utils.iam
'''
# Import Python libs
from __future__ import absolute_import, print_function, unicode_literals
import salt.utils.iam as iam
from salt.ext import six
from tests.support.unit import TestCase, skipIf
class IamTestCase(TestCase):
@skipIf(six.PY3, 'Only needs to run on Python 2')
def test__convert_key_to_str(self):
'''
Makes sure that unicode string is converted to a str type on PY2
'''
key = 'foo'
expected = key.encode('utf-8')
self.assertEqual(iam._convert_key_to_str(key), expected)