def test_can_parse_info_for_essential_packages(self): """fab.tests.os.linux.ubuntu_package_info_test Can parse info for essential packages""" essential_package_info = UbuntuPackageInfo.from_text(self._essential_package_info_partial()) self._verify_expected_package_info_details(essential_package_info, "base-files", "4.0.1ubuntu5", "installed", "base-files (4.0.1ubuntu5)") self.assertEqual(UbuntuPackageInfo("base-files", "4.0.1ubuntu5", "installed"), essential_package_info)
def test_can_recognise_a_package_that_is_not_installed(self): """fab.tests.os.linux.ubuntu_package_info_test Can recognise a package that is not installed""" self.assertFalse( UbuntuPackageInfo.from_text( self._not_installed_package_info_partial()).is_installed(), "Should recognise a package that is not installed")
def test_name_and_installed_version_member_should_display_none_if_package_is_not_installed(self): """fab.tests.os.linux.ubuntu_package_info_test The name_and_installed_version member should display state if package is not installed""" not_installed_package_info = UbuntuPackageInfo.from_text(self._not_installed_package_info_partial()) self.assertFalse(not_installed_package_info.is_installed(), "Package state should be 'not installed'") self.assertEqual("g++ (not installed)", not_installed_package_info.name_and_installed_version)
def test_name_and_installed_version_member_should_display_none_if_package_is_not_installed( self): """fab.tests.os.linux.ubuntu_package_info_test The name_and_installed_version member should display state if package is not installed""" not_installed_package_info = UbuntuPackageInfo.from_text( self._not_installed_package_info_partial()) self.assertFalse(not_installed_package_info.is_installed(), "Package state should be 'not installed'") self.assertEqual("g++ (not installed)", not_installed_package_info.name_and_installed_version)
def test_can_parse_info_for_essential_packages(self): """fab.tests.os.linux.ubuntu_package_info_test Can parse info for essential packages""" essential_package_info = UbuntuPackageInfo.from_text( self._essential_package_info_partial()) self._verify_expected_package_info_details( essential_package_info, "base-files", "4.0.1ubuntu5", "installed", "base-files (4.0.1ubuntu5)") self.assertEqual( UbuntuPackageInfo("base-files", "4.0.1ubuntu5", "installed"), essential_package_info)
def test_can_get_package_info_for_specified_package(self): """fab.tests.os.linux.ubuntu_package_inspector_test Can get package info for a specified package""" package_info_text = "\r\n".join(["Package: linux-libc-dev", "State: installed", "Automatically installed: no", "Version: 2.6.24-29.93", "Priority: optional", "Section: devel"]) self.mock_host_controller.hide_command_and_output().AndReturn(fabric.api.hide('running', 'stdout')) self.mock_host_controller.run("aptitude show linux-libc-dev").AndReturn(package_info_text) self.mox.ReplayAll() expected_package_info = UbuntuPackageInfo.from_text(package_info_text) self.assertEqual(expected_package_info, self.package_inspector.info_for("linux-libc-dev"))
def test_can_get_package_info_for_specified_package(self): """fab.tests.os.linux.ubuntu_package_inspector_test Can get package info for a specified package""" package_info_text = "\r\n".join([ "Package: linux-libc-dev", "State: installed", "Automatically installed: no", "Version: 2.6.24-29.93", "Priority: optional", "Section: devel" ]) self.mock_host_controller.hide_command_and_output().AndReturn( fabric.api.hide('running', 'stdout')) self.mock_host_controller.run( "aptitude show linux-libc-dev").AndReturn(package_info_text) self.mox.ReplayAll() expected_package_info = UbuntuPackageInfo.from_text(package_info_text) self.assertEqual(expected_package_info, self.package_inspector.info_for("linux-libc-dev"))
def info_for(self, package_name): with self.host_controller.hide_command_and_output(): return UbuntuPackageInfo.from_text(self.host_controller.run("aptitude show %s" % package_name))
def setUp(self): self.package_info = UbuntuPackageInfo.from_text( self._installed_package_info_full())
def test_can_recognise_a_package_that_is_not_installed(self): """fab.tests.os.linux.ubuntu_package_info_test Can recognise a package that is not installed""" self.assertFalse(UbuntuPackageInfo.from_text(self._not_installed_package_info_partial()).is_installed(), "Should recognise a package that is not installed")
def setUp(self): self.package_info = UbuntuPackageInfo.from_text(self._installed_package_info_full())
def info_for(self, package_name): with self.host_controller.hide_command_and_output(): return UbuntuPackageInfo.from_text( self.host_controller.run("aptitude show %s" % package_name))