def test_remove_nopan_error(self): ''' Test if it gives no cpan error while removing ''' ret = {'error': 'No CPAN data available to use for uninstalling'} mock = MagicMock(return_value={'installed version': '2.1'}) with patch.object(cpan, 'show', mock): self.assertDictEqual(cpan.remove('Alloy'), ret)
def test_remove_nopan_error(self): """ Test if it gives no cpan error while removing """ ret = {"error": "No CPAN data available to use for uninstalling"} mock = MagicMock(return_value={"installed version": "2.1"}) with patch.object(cpan, "show", mock): self.assertDictEqual(cpan.remove("Alloy"), ret)
def test_remove_noninstalled_error(self): ''' Test if it remove non installed module using cpan ''' mock = MagicMock(return_value={'installed version': None}) with patch.object(cpan, 'show', mock): self.assertDictEqual(cpan.remove('Alloy'), {'new': None, 'old': None})
def test_remove_unexist_error(self): ''' Test if it try to remove an unexist module using cpan ''' mock = MagicMock(return_value="don't know what it is") with patch.dict(cpan.__salt__, {'cmd.run': mock}): self.assertDictEqual( cpan.remove('Alloy'), {'error': 'This package does not seem to exist'})
def test_remove_unexist_error(self): ''' Test if it try to remove an unexist module using cpan ''' mock = MagicMock(return_value="don't know what it is") with patch.dict(cpan.__salt__, {'cmd.run': mock}): self.assertDictEqual(cpan.remove('Alloy'), {'error': 'This package does not seem to exist'})
def test_remove_unexist_error(self): """ Test if it try to remove an unexist module using cpan """ mock = MagicMock(return_value="don't know what it is") with patch.dict(cpan.__salt__, {"cmd.run": mock}): self.assertDictEqual( cpan.remove("Alloy"), {"error": "This package does not seem to exist"})
def test_remove_noninstalled_error(self): ''' Test if it remove non installed module using cpan ''' mock = MagicMock(return_value={'installed version': None}) with patch.object(cpan, 'show', mock): self.assertDictEqual(cpan.remove('Alloy'), { 'new': None, 'old': None })
def test_remove_noninstalled_error(self): """ Test if it remove non installed module using cpan """ mock = MagicMock(return_value={"installed version": None}) with patch.object(cpan, "show", mock): self.assertDictEqual(cpan.remove("Alloy"), { "new": None, "old": None })
def test_remove_unexist_error(self): ''' Test if it try to remove an unexist module using cpan ''' mock = MagicMock(return_value={'error': ""}) module = 'Nonexistant::Package' with patch.dict(cpan.__salt__, {'cmd.run_all': mock}): self.assertDictEqual(cpan.remove(module), { 'error': 'Could not find package {}'.format(module), 'new': None, 'old': None})
def test_remove(self): ''' Test if it remove a module using cpan ''' mock = MagicMock(return_value='') with patch.dict(cpan.__salt__, {'cmd.run': mock}): mock = MagicMock(return_value={'installed version': '2.1', 'cpan build dirs': [''], 'installed file': '/root'}) with patch.object(cpan, 'show', mock): self.assertDictEqual(cpan.remove('Alloy'), {'new': None, 'old': '2.1'})
def test_remove_no_cpan_error(self): ''' Test if it gives no cpan error while removing, If nothing has changed then an empty dictionary will be returned ''' mock = MagicMock(return_value={'installed version': '2.1', 'installed file': "", 'cpan build dirs': []}) with patch.object(cpan, 'show', mock): self.assertDictEqual(cpan.remove('File::Temp'), { 'error': None, 'new': None, 'old': None})
def test_remove(self): ''' Test if it remove a module using cpan ''' with patch('os.listdir', MagicMock(return_value=[''])): mock = MagicMock(return_value={}) module = 'File::Temp' with patch.dict(cpan.__salt__, {'cmd.run_all': mock}): mock = MagicMock(return_value={'installed version': '2.1', 'cpan build dirs': [''], 'installed file': '/root'}) with patch.object(cpan, 'show', mock): self.assertDictEqual(cpan.remove(module), { 'error': None, 'new': None, 'old': None})
def test_remove(self): ''' Test if it remove a module using cpan ''' mock = MagicMock(return_value='') with patch.dict(cpan.__salt__, {'cmd.run': mock}): mock = MagicMock( return_value={ 'installed version': '2.1', 'cpan build dirs': [''], 'installed file': '/root' }) with patch.object(cpan, 'show', mock): self.assertDictEqual(cpan.remove('Alloy'), { 'new': None, 'old': '2.1' })
def test_remove(self): """ Test if it remove a module using cpan """ with patch("os.listdir", MagicMock(return_value=[""])): mock = MagicMock(return_value="") with patch.dict(cpan.__salt__, {"cmd.run": mock}): mock = MagicMock( return_value={ "installed version": "2.1", "cpan build dirs": [""], "installed file": "/root", }) with patch.object(cpan, "show", mock): self.assertDictEqual(cpan.remove("Alloy"), { "new": None, "old": "2.1" })
def test_remove(self): """ Test if it remove a module using cpan ''' with patch('os.listdir', MagicMock(return_value=[''])): mock = MagicMock(return_value={}) module = 'File::Temp' with patch.dict(cpan.__salt__, {'cmd.run_all': mock}): mock = MagicMock(return_value={'installed version': '2.1', 'cpan build dirs': [''], 'installed file': '/root'}) with patch.object(cpan, 'show', mock): self.assertDictEqual(cpan.remove(module), { 'error': None, 'new': None, 'old': None}) def test_remove_unexist_error(self): """ Test if it try to remove an unexist module using cpan ''' mock = MagicMock(return_value={'error': ""}) module = 'Nonexistant::Package' with patch.dict(cpan.__salt__, {'cmd.run_all': mock}): self.assertDictEqual(cpan.remove(module), { 'error': 'Could not find package {}'.format(module), 'new': None, 'old': None}) def test_remove_noninstalled_error(self): """ Test if it remove non installed module using cpan ''' mock = MagicMock(return_value={'installed version': None}) with patch.object(cpan, 'show', mock): self.assertDictEqual(cpan.remove('File::Temp'), { 'error': None, 'new': None, 'old': None})