1
0

test_iam.py 600 B

123456789101112131415161718192021
  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)