def test_disable(self): """ Test if it disable an interface. """ with patch.object(win_ip, "is_disabled", return_value=True): self.assertTrue(win_ip.disable("Ethernet")) mock_cmd = MagicMock() with patch.object(win_ip, "is_disabled", side_effect=[False, True ]), patch.dict(win_ip.__salt__, {"cmd.run": mock_cmd}): self.assertTrue(win_ip.disable("Ethernet")) mock_cmd.called_once_with( [ "netsh", "interface", "set", "interface", "name=Ethernet", "admin=DISABLED", ], python_shell=False, )
def test_disable(self): ''' Test if it disable an interface. ''' mock_cmd = MagicMock(return_value=ETHERNET_ENABLE) with patch.dict(win_ip.__salt__, {'cmd.run': mock_cmd}): self.assertFalse(win_ip.disable('Ethernet')) mock_cmd = MagicMock(return_value='Connect state: Disconnected') with patch.dict(win_ip.__salt__, {'cmd.run': mock_cmd}): self.assertTrue(win_ip.disable('Ethernet'))
def test_disable(self): """ Test if it disable an interface. """ mock_cmd = MagicMock(return_value=ETHERNET_ENABLE) with patch.dict(win_ip.__salt__, {"cmd.run": mock_cmd}): self.assertFalse(win_ip.disable("Ethernet")) mock_cmd = MagicMock(return_value="Connect state: Disconnected") with patch.dict(win_ip.__salt__, {"cmd.run": mock_cmd}): self.assertTrue(win_ip.disable("Ethernet"))
def test_disable(self): ''' Test if it disable an interface. ''' with patch.object(win_ip, 'is_disabled', return_value=True): self.assertTrue(win_ip.disable('Ethernet')) mock_cmd = MagicMock() with patch.object(win_ip, 'is_disabled', side_effect=[False, True]),\ patch.dict(win_ip.__salt__, {'cmd.run': mock_cmd}): self.assertTrue(win_ip.disable('Ethernet')) mock_cmd.called_once_with([ 'netsh', 'interface', 'set', 'interface', 'name=Ethernet', 'admin=DISABLED' ], python_shell=False)