test_pillar_ldap.py 775 B

1234567891011121314151617181920212223242526
  1. # -*- coding: utf-8 -*-
  2. # Import python libs
  3. from __future__ import absolute_import, print_function, unicode_literals
  4. from tests.support.unit import TestCase
  5. import salt.utils.stringutils
  6. from salt.pillar.pillar_ldap import _config
  7. class LdapPillarTestCase(TestCase):
  8. def test__config_returns_str(self):
  9. conf = {'foo': 'bar'}
  10. assert _config('foo', conf) == salt.utils.stringutils.to_str('bar')
  11. def test__conf_defaults_to_none(self):
  12. conf = {'foo': 'bar'}
  13. assert _config('bang', conf) is None
  14. def test__conf_returns_str_from_unicode_default(self):
  15. conf = {'foo': 'bar'}
  16. default = salt.utils.stringutils.to_unicode('bam')
  17. assert _config('bang', conf, default) == salt.utils.stringutils.to_str('bam')