test_win_ip.py 920 B

1234567891011121314151617181920212223242526272829303132333435
  1. # -*- coding: utf-8 -*-
  2. # Import Python libs
  3. from __future__ import absolute_import, print_function, unicode_literals
  4. import re
  5. # Import Salt libs
  6. import salt.utils.platform
  7. # Import Salt Testing libs
  8. from tests.support.case import ModuleCase
  9. from tests.support.unit import skipIf
  10. @skipIf(not salt.utils.platform.is_windows(), "windows test only")
  11. class WinIPTest(ModuleCase):
  12. """
  13. Tests for salt.modules.win_ip
  14. """
  15. def test_get_default_gateway(self):
  16. """
  17. Test getting default gateway
  18. """
  19. ip = re.compile(r"^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$")
  20. ret = self.run_function("ip.get_default_gateway")
  21. assert ip.match(ret)
  22. def test_ip_is_enabled(self):
  23. """
  24. Test ip.is_enabled
  25. """
  26. assert self.run_function("ip.is_enabled", ["Ethernet"])
  27. assert "not found" in self.run_function("ip.is_enabled", ["doesnotexist"])