test_doc.py 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. # -*- coding: utf-8 -*-
  2. """
  3. Unit Tests for functions located in salt.utils.doc.py.
  4. """
  5. # Import python libs
  6. from __future__ import absolute_import, print_function, unicode_literals
  7. # Import Salt libs
  8. import salt.utils.doc
  9. # Import Salt Testing libs
  10. from tests.support.unit import TestCase
  11. class DocUtilsTestCase(TestCase):
  12. """
  13. Test case for doc util.
  14. """
  15. def test_parse_docstring(self):
  16. test_keystone_str = """Management of Keystone users
  17. ============================
  18. :depends: - keystoneclient Python module
  19. :configuration: See :py:mod:`salt.modules.keystone` for setup instructions.
  20. """
  21. ret = salt.utils.doc.parse_docstring(test_keystone_str)
  22. expected_dict = {
  23. "deps": ["keystoneclient"],
  24. "full": "Management of Keystone users\n "
  25. "============================\n\n "
  26. ":depends: - keystoneclient Python module\n "
  27. ":configuration: See :py:mod:`salt.modules.keystone` for setup instructions.\n",
  28. }
  29. self.assertDictEqual(ret, expected_dict)