def test_check_no_checkinstall(self): fpm_out = _AttributeString("/usr/local/bin/fpm") fpm_out.return_code = 0 checkinstall_out = _AttributeString("/usr/bin/checkinstall") checkinstall_out.return_code = 1 distro_run.side_effect = [fpm_out, checkinstall_out] with self.assertRaises(Exception): debian.check()
def test_check_no_checkinstall(self): fpm_out = _AttributeString("/usr/local/bin/fpm") fpm_out.return_code = 0 checkinstall_out = _AttributeString("/usr/bin/checkinstall") checkinstall_out.return_code = 1 distro_run.side_effect = [fpm_out, checkinstall_out] with self.assertRaises(Exception): debian.check()
def test_version_not_found(self): out = _AttributeString("") out.return_code = 1 version_run.return_value = out ret = debian.version('test_pkg') version_run.assert_called_once_with('apt-cache show %s 2>/dev/null | sed -nr "s/^Version: ([0-9]+)(-.+)?/\\1/p"'%('test_pkg')) self.assertEqual(ret, None)
def test_check_no_fpm(self): fpm_out = _AttributeString() fpm_out.return_code = 1 distro_run.side_effect = [fpm_out] with self.assertRaises(Exception): centos.check()
def test_centos_version_not_found(self): out = _AttributeString("") out.return_code = 1 version_run.return_value = out ret = centos.version('test_pkg') version_run.assert_called_once_with('rpm -qi %s 2>/dev/null | sed -nr "s/^Version.+: ([0-9]+)(-.+)?/\\1/p"'%('test_pkg')) self.assertEqual(ret, None)
def test_check_no_fpm(self): fpm_out = _AttributeString() fpm_out.return_code = 1 distro_run.side_effect = [fpm_out] with self.assertRaises(Exception): centos.check()
def test_centos_check(self): out = _AttributeString("/usr/local/bin/fpm") out.return_code = 0 run.return_value = out centos.check() # check for fpm self.assertTrue( 'which fpm' in run.call_args_list[0][0][0])
def test_centos_check(self): out = _AttributeString("/usr/local/bin/fpm") out.return_code = 0 run.return_value = out centos.check() # check for fpm self.assertTrue('which fpm' in run.call_args_list[0][0][0])
def test_version_not_found(self): out = _AttributeString("") out.return_code = 1 version_run.return_value = out ret = debian.version('test_pkg') version_run.assert_called_once_with( 'apt-cache show %s 2>/dev/null | sed -nr "s/^Version: ([0-9]+)(-.+)?/\\1/p"' % ('test_pkg')) self.assertEqual(ret, None)
def test_centos_version_not_found(self): out = _AttributeString("") out.return_code = 1 version_run.return_value = out ret = centos.version('test_pkg') version_run.assert_called_once_with( 'rpm -qi %s 2>/dev/null | sed -nr "s/^Version.+: ([0-9]+)(-.+)?/\\1/p"' % ('test_pkg')) self.assertEqual(ret, None)