1
0

test_iam.py 601 B

12345678910111213141516171819202122
  1. # -*- coding: utf-8 -*-
  2. '''
  3. Tests for salt.utils.iam
  4. '''
  5. # Import Python libs
  6. from __future__ import absolute_import, print_function, unicode_literals
  7. import salt.utils.iam as iam
  8. from salt.ext import six
  9. from tests.support.unit import TestCase, skipIf
  10. class IamTestCase(TestCase):
  11. @skipIf(six.PY3, 'Only needs to run on Python 2')
  12. def test__convert_key_to_str(self):
  13. '''
  14. Makes sure that unicode string is converted to a str type on PY2
  15. '''
  16. key = 'foo'
  17. expected = key.encode('utf-8')
  18. self.assertEqual(iam._convert_key_to_str(key), expected)