test_yaml.py 754 B

1234567891011121314151617181920212223242526272829
  1. # -*- coding: utf-8 -*-
  2. # Import Python Libs
  3. from __future__ import absolute_import, print_function, unicode_literals
  4. # Import Salt Testing libs
  5. from tests.support.mixins import LoaderModuleMockMixin
  6. from tests.support.unit import TestCase
  7. # Import Salt libs
  8. import salt.renderers.yaml as yaml
  9. class YAMLRendererTestCase(TestCase, LoaderModuleMockMixin):
  10. def setup_loader_modules(self):
  11. return {yaml: {}}
  12. def test_yaml_render_string(self):
  13. data = 'string'
  14. result = yaml.render(data)
  15. self.assertEqual(result, data)
  16. def test_yaml_render_unicode(self):
  17. data = '!!python/unicode python unicode string'
  18. result = yaml.render(data)
  19. self.assertEqual(result, u'python unicode string')