<commit_before># -*- coding: utf-8 -*-
'''
    :codeauthor: :email:`<NAME> <<EMAIL>>`
'''

# Import Python Libs
from __future__ import absolute_import

# Import Salt Testing Libs
from salttesting import TestCase, skipIf
from salttesting.mock import (
    MagicMock,
    patch,
    call
)

from salttesting.helpers import ensure_in_syspath

ensure_in_syspath('../../')

# Import Salt Libs
from salt.modules import win_firewall

# Globals
win_firewall.__salt__ = {}

# Make sure this module runs on Windows system
IS_WIN = win_firewall.__virtual__()


@skipIf(not IS_WIN[0], "This test case runs only on Windows system")
class WinFirewallTestCase(TestCase):
    '''
    Test cases for salt.modules.win_firewall
    '''
    # 'get_config' function tests: 1

    def test_get_config(self):
        '''
        Test if it get the status of all the firewall profiles
        '''
        mock_cmd = MagicMock(return_value='')
        with patch.dict(win_firewall.__salt__, {'cmd.run': mock_cmd}):
            self.assertDictEqual(win_firewall.get_config(), {})
            mock_cmd.assert_called_once_with(['netsh', 'advfirewall', 'show', 'allprofiles'], python_shell=False)

    # 'disable' function tests: 1

    def test_disable(self):
        '''
        Test if it disable firewall profile :(default: allprofiles)
        '''
        mock_cmd = MagicMock(return_value='Ok.')
        with patch.dict(win_firewall.__salt__, {'cmd.run': mock_cmd}):
            self.assertTrue(win_firewall.disable())
            mock_cmd.assert_called_once_with(['netsh', 'advfirewall', 'set', 'allprofiles', 'state', 'off'],
                                             python_shell=False)<commit_msg>Update windows gate to use salt.utils.is_windows()<commit_after># -*- coding: utf-8 -*-
'''
    :codeauthor: :email:`<NAME> <<EMAIL>>`
'''

# Import Python Libs
from __future__ import absolute_import

# Import Salt Testing Libs
from salttesting import TestCase, skipIf
from salttesting.mock import (
    MagicMock,
    patch,
    call
)

from salttesting.helpers import ensure_in_syspath

ensure_in_syspath('../../')

# Import Salt Libs
from salt.modules import win_firewall
import salt.utils

# Globals
win_firewall.__salt__ = {}


@skipIf(not salt.utils.is_windows(), 'This test case runs only on Windows system')
class WinFirewallTestCase(TestCase):
    '''
    Test cases for salt.modules.win_firewall
    '''
    # 'get_config' function tests: 1

    def test_get_config(self):
        '''
        Test if it get the status of all the firewall profiles
        '''
        mock_cmd = MagicMock(return_value='')
        with patch.dict(win_firewall.__salt__, {'cmd.run': mock_cmd}):
            self.assertDictEqual(win_firewall.get_config(), {})
            mock_cmd.assert_called_once_with(['netsh', 'advfirewall', 'show', 'allprofiles'], python_shell=False)

    # 'disable' function tests: 1

    def test_disable(self):
        '''
        Test if it disable firewall profile :(default: allprofiles)
        '''
        mock_cmd = MagicMock(return_value='Ok.')
        with patch.dict(win_firewall.__salt__, {'cmd.run': mock_cmd}):
            self.assertTrue(win_firewall.disable())
            mock_cmd.assert_called_once_with(['netsh', 'advfirewall', 'set', 'allprofiles', 'state', 'off'],
                                             python_shell=False)
{'fraction_non_alphanumeric': 0.12249775918733194, 'fraction_numerical': 0.002091425156856887, 'mean_word_length': 3.097919216646267, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4319074', 'n_tokens_mistral': 1026, 'n_tokens_neox': 998, 'n_words': 246}