test_test.py 2.5 KB

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