Exemplo n.º 1
0
def test_get_no_sysctl_binary():
    """
    Tests the failure of get function when no binary exists
    """
    with patch("salt.utils.path.which", MagicMock(return_value=None)):
        with pytest.raises(CommandExecutionError):
            linux_sysctl.get("net.ipv4.ip_forward")
Exemplo n.º 2
0
 def test_get(self):
     '''
     Tests the return of get function
     '''
     mock_cmd = MagicMock(return_value=1)
     with patch.dict(linux_sysctl.__salt__, {'cmd.run': mock_cmd}):
         self.assertEqual(linux_sysctl.get('net.ipv4.ip_forward'), 1)
Exemplo n.º 3
0
 def test_get(self):
     '''
     Tests the return of get function
     '''
     mock_cmd = MagicMock(return_value=1)
     with patch.dict(linux_sysctl.__salt__, {'cmd.run': mock_cmd}):
         self.assertEqual(linux_sysctl.get('net.ipv4.ip_forward'), 1)
Exemplo n.º 4
0
 def test_get(self):
     """
     Tests the return of get function
     """
     mock_cmd = MagicMock(return_value=1)
     with patch.dict(linux_sysctl.__salt__, {"cmd.run": mock_cmd}):
         self.assertEqual(linux_sysctl.get("net.ipv4.ip_forward"), 1)
Exemplo n.º 5
0
 def test_get_ignore(self):
     """
     Tests the return of get function with ignore
     """
     mock_cmd = MagicMock(return_value="")
     with patch.dict(linux_sysctl.__salt__, {"cmd.run": mock_cmd}):
         self.assertEqual(
             linux_sysctl.get("net.ipv4.ip_forward", ignore=True), "")