test_color.py 821 B

1234567891011121314151617181920212223242526272829
  1. # -*- coding: utf-8 -*-
  2. """
  3. Unit tests for salt.utils.color.py
  4. """
  5. # Import python libs
  6. from __future__ import absolute_import, print_function, unicode_literals
  7. # Import Salt libs
  8. import salt.utils.color
  9. from salt.ext import six
  10. # Import Salt Testing libs
  11. from tests.support.unit import TestCase
  12. class ColorUtilsTestCase(TestCase):
  13. def test_get_colors(self):
  14. ret = salt.utils.color.get_colors()
  15. self.assertEqual("\x1b[0;37m", six.text_type(ret["LIGHT_GRAY"]))
  16. ret = salt.utils.color.get_colors(use=False)
  17. self.assertDictContainsSubset({"LIGHT_GRAY": ""}, ret)
  18. ret = salt.utils.color.get_colors(use="LIGHT_GRAY")
  19. # LIGHT_YELLOW now == LIGHT_GRAY
  20. self.assertEqual(
  21. six.text_type(ret["LIGHT_YELLOW"]), six.text_type(ret["LIGHT_GRAY"])
  22. )