1
0

test_pending_reboot.py 927 B

1234567891011121314151617181920212223242526272829
  1. # -*- coding: utf-8 -*-
  2. """
  3. :codeauthor: :email:`Shane Lee <slee@saltstack.com>`
  4. """
  5. # Import Python libs
  6. from __future__ import absolute_import, print_function, unicode_literals
  7. # Import Salt Libs
  8. import salt.grains.pending_reboot as pending_reboot
  9. from tests.support.mock import patch
  10. # Import Salt Testing Libs
  11. from tests.support.unit import TestCase
  12. class PendingRebootGrainTestCase(TestCase):
  13. """
  14. Test cases for pending_reboot grain
  15. """
  16. def test_pending_reboot_false(self):
  17. with patch("salt.utils.win_system.get_pending_reboot", return_value=False):
  18. result = pending_reboot.pending_reboot()
  19. self.assertFalse(result["pending_reboot"])
  20. def test_pending_reboot_true(self):
  21. with patch("salt.utils.win_system.get_pending_reboot", return_value=True):
  22. result = pending_reboot.pending_reboot()
  23. self.assertTrue(result["pending_reboot"])