1
0

test_win_ip.py 918 B

123456789101112131415161718192021222324252627282930313233
  1. # -*- coding: utf-8 -*-
  2. # Import Python libs
  3. from __future__ import absolute_import, print_function, unicode_literals
  4. import re
  5. # Import Salt Testing libs
  6. from tests.support.case import ModuleCase
  7. from tests.support.unit import skipIf
  8. # Import Salt libs
  9. import salt.utils.platform
  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'])