def test_new_chain(self): ''' Test if it create new custom chain to the specified table. ''' self.assertEqual(iptables.new_chain(table='filter', chain=None, family='ipv4'), 'Error: Chain needs to be specified') mock_cmd = MagicMock(return_value='') with patch.dict(iptables.__salt__, {'cmd.run': mock_cmd}): self.assertTrue(iptables.new_chain(table='filter', chain='INPUT', family='ipv4'))
def test_new_chain(self): ''' Test if it create new custom chain to the specified table. ''' self.assertEqual(iptables.new_chain(table='filter', chain=None, family='ipv4'), 'Error: Chain needs to be specified') mock_cmd = MagicMock(return_value='') with patch.dict(iptables.__salt__, {'cmd.run': mock_cmd}): self.assertTrue(iptables.new_chain(table='filter', chain='INPUT', family='ipv4'))
def test_new_chain(self): """ Test if it create new custom chain to the specified table. """ self.assertEqual( iptables.new_chain(table="filter", chain=None, family="ipv4"), "Error: Chain needs to be specified", ) mock_cmd = MagicMock(return_value="") with patch.dict(iptables.__salt__, {"cmd.run": mock_cmd}): self.assertTrue( iptables.new_chain(table="filter", chain="INPUT", family="ipv4"))