def is_installed(self): # (cp16net) could raise an exception, does it need to be handled here? version = pkg.pkg_version(self.MYSQL_PACKAGE_VERSION) return not version is None
def test_version_no_version(self): cmd_out = self.build_output(self.pkgName, '<none>') commands.getstatusoutput = Mock(return_value=(0, cmd_out)) self.assertFalse(pkg.pkg_version(self.pkgName))
def test_version_status_error(self): cmd_out = self.build_output(self.pkgName, self.pkgVersion) commands.getstatusoutput = Mock(return_value=(1, cmd_out)) self.assertFalse(pkg.pkg_version(self.pkgName))
def test_version_unknown_package(self): unk_parts = "un " + self.pkgName + " " + self.pkgVersion + " \n" cmd_out = self.build_output(self.pkgName, self.pkgVersion, unk_parts) commands.getstatusoutput = Mock(return_value=(0, cmd_out)) self.assertFalse(pkg.pkg_version(self.pkgName))
def test_version_success(self): cmd_out = self.build_output(self.pkgName, self.pkgVersion) commands.getstatusoutput = Mock(return_value=(0, cmd_out)) version = pkg.pkg_version(self.pkgName) self.assertTrue(version) self.assertEqual(self.pkgVersion, version)