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_determine_equality_between_package_info_instances(self):
        """fab.tests.os.linux.ubuntu_package_info_test  Can determine equality between package info instances"""

        package_info1a = UbuntuPackageInfo('package1', '1:1.1', 'installed')
        package_info1b = UbuntuPackageInfo('package1', '1:1.1', 'installed')

        self.assertEqual(package_info1a, package_info1a,
                         "Same instance should be equal to itself")
        self.assertNotEqual(
            UbuntuPackageInfo('package1', '1:1.1', 'installed'),
            UbuntuPackageInfo('package2', '1:1.1', 'installed'),
            "Instances should not be equal when package names differ")
        self.assertNotEqual(
            UbuntuPackageInfo('package1', '1:1.1', 'installed'),
            UbuntuPackageInfo('package1', '1:2.1', 'installed'),
            "Instances should not be equal when package versions differ")
        self.assertNotEqual(
            UbuntuPackageInfo('package1', '1:1.1', 'installed'),
            UbuntuPackageInfo('package1', '1:1.1', 'not installed'),
            "Instances should not be equal when package installation states differ"
        )
        self.assertEqual(
            package_info1a, package_info1b,
            "Different instances with same package name, version and state should be equal"
        )
    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_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_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_has_expected_package_info_members(self):
        """fab.tests.os.linux.ubuntu_package_info_test  Has expected package info members"""

        self._verify_expected_package_info_details(self.package_info, "g++",
                                                   "4:4.2.3-1ubuntu6",
                                                   "installed",
                                                   "g++ (4:4.2.3-1ubuntu6)")
        self.assertEqual(
            UbuntuPackageInfo("g++", "4:4.2.3-1ubuntu6", "installed"),
            self.package_info)
    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_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"))
Exemplo n.º 10
0
 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())
Exemplo n.º 14
0
 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))