예제 #1
0
 def test_delete_rule(self):
     """
     Test if it delete an existing firewall rule
     """
     mock_cmd = MagicMock(return_value="Ok.")
     with patch.dict(win_firewall.__salt__, {"cmd.run": mock_cmd}):
         self.assertTrue(win_firewall.delete_rule("test", "8080", "tcp", "in"))
예제 #2
0
 def test_delete_rule(self):
     '''
     Test if it delete an existing firewall rule
     '''
     mock_cmd = MagicMock(return_value='Ok.')
     with patch.dict(win_firewall.__salt__, {'cmd.run': mock_cmd}):
         self.assertTrue(win_firewall.delete_rule("test", "8080", "tcp",
                                                  "in"))
예제 #3
0
 def test_delete_rule_icmp4_any(self):
     '''
     Test if it deletes a new firewall rule
     '''
     mock_cmd = MagicMock(return_value='Ok.')
     with patch.dict(win_firewall.__salt__, {'cmd.run': mock_cmd}):
         self.assertTrue(win_firewall.delete_rule("test", "1", protocol='icmpv4:any,any'))
         mock_cmd.assert_called_once_with(['netsh', 'advfirewall', 'firewall', 'delete', 'rule', 'name=test',
                                           'protocol=icmpv4:any,any', 'dir=in'],
                                          python_shell=False)
예제 #4
0
 def test_delete_rule(self):
     '''
     Test if it delete an existing firewall rule
     '''
     mock_cmd = MagicMock(return_value='Ok.')
     with patch.dict(win_firewall.__salt__, {'cmd.run': mock_cmd}):
         self.assertTrue(win_firewall.delete_rule("test", "8080", "tcp",
                                                  "in"))
         mock_cmd.assert_called_once_with(['netsh', 'advfirewall', 'firewall', 'delete', 'rule', 'name=test',
                                           'protocol=tcp', 'dir=in', 'localport=8080'], python_shell=False)