test_test.py 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. # -*- coding: utf-8 -*-
  2. from __future__ import absolute_import, print_function, unicode_literals
  3. import logging
  4. import pytest
  5. import salt.config
  6. import salt.version
  7. from tests.support.case import ModuleCase
  8. from tests.support.helpers import slowTest
  9. from tests.support.mixins import AdaptedConfigurationTestCaseMixin
  10. log = logging.getLogger(__name__)
  11. @pytest.mark.windows_whitelisted
  12. class TestModuleTest(ModuleCase, AdaptedConfigurationTestCaseMixin):
  13. """
  14. Validate the test module
  15. """
  16. @slowTest
  17. def test_ping(self):
  18. """
  19. test.ping
  20. """
  21. self.assertTrue(self.run_function("test.ping"))
  22. @slowTest
  23. def test_echo(self):
  24. """
  25. test.echo
  26. """
  27. self.assertEqual(self.run_function("test.echo", ["text"]), "text")
  28. @slowTest
  29. def test_version(self):
  30. """
  31. test.version
  32. """
  33. self.assertEqual(
  34. self.run_function("test.version"), salt.version.__saltstack_version__.string
  35. )
  36. @slowTest
  37. def test_conf_test(self):
  38. """
  39. test.conf_test
  40. """
  41. self.assertEqual(self.run_function("test.conf_test"), "baz")
  42. @slowTest
  43. def test_get_opts(self):
  44. """
  45. test.get_opts
  46. """
  47. opts = salt.config.minion_config(self.get_config_file_path("minion"))
  48. self.assertEqual(
  49. self.run_function("test.get_opts")["cachedir"], opts["cachedir"]
  50. )
  51. @slowTest
  52. def test_cross_test(self):
  53. """
  54. test.cross_test
  55. """
  56. self.assertTrue(self.run_function("test.cross_test", ["test.ping"]))
  57. @slowTest
  58. def test_fib(self):
  59. """
  60. test.fib
  61. """
  62. self.assertEqual(self.run_function("test.fib", ["20"],)[0], 6765)
  63. @slowTest
  64. def test_collatz(self):
  65. """
  66. test.collatz
  67. """
  68. self.assertEqual(self.run_function("test.collatz", ["40"],)[0][-1], 2)
  69. @slowTest
  70. def test_outputter(self):
  71. """
  72. test.outputter
  73. """
  74. self.assertEqual(self.run_function("test.outputter", ["text"]), "text")