def test_save(self): ''' Test if it save the current in-memory rules to disk ''' mock = MagicMock(return_value=True) with patch.dict(iptables.__salt__, {'cmd.run': mock, 'file.write': mock}): self.assertTrue(iptables.save(filename='/xyz', family='ipv4'))
def test_save(self): ''' Test if it save the current in-memory rules to disk ''' with patch('salt.modules.iptables._conf', MagicMock(return_value=False)), \ patch('os.path.isdir', MagicMock(return_value=True)): mock = MagicMock(return_value=True) with patch.dict(iptables.__salt__, {'cmd.run': mock, 'file.write': mock, 'config.option': MagicMock(return_value=[])}): self.assertTrue(iptables.save(filename='/xyz', family='ipv4'))
def test_save(self): """ Test if it save the current in-memory rules to disk """ with patch("salt.modules.iptables._conf", MagicMock(return_value=False)), patch( "os.path.isdir", MagicMock(return_value=True)): mock = MagicMock(return_value=True) with patch.dict( iptables.__salt__, { "cmd.run": mock, "file.write": mock, "config.option": MagicMock(return_value=[]), }, ): self.assertTrue(iptables.save(filename="/xyz", family="ipv4"))