def test_version(self): ''' Test for Return version from ipset --version ''' with patch.object(ipset, '_ipset_cmd', return_value='A'): mock = MagicMock(return_value="A\nB\nC") with patch.dict(ipset.__salt__, {'cmd.run': mock}): self.assertEqual(ipset.version(), 'B')
def test_version(): """ Test for Return version from ipset --version """ with patch.object(ipset, "_ipset_cmd", return_value="A"): mock = MagicMock(return_value="A\nB\nC") with patch.dict(ipset.__salt__, {"cmd.run": mock}): assert ipset.version() == "B"