test_color.py 800 B

12345678910111213141516171819202122232425262728
  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 Testing libs
  8. from tests.support.unit import TestCase
  9. # Import Salt libs
  10. import salt.utils.color
  11. from salt.ext import six
  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(six.text_type(ret['LIGHT_YELLOW']), six.text_type(ret['LIGHT_GRAY']))