class UbuntuPackageInspectorTest(mox.MoxTestBase):
    def setUp(self):
        super(UbuntuPackageInspectorTest, self).setUp()
        self.mock_host_controller = self.mox.CreateMock(RemoteHostController)

        self.package_inspector = UbuntuPackageInspector(
            self.mock_host_controller)

    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"))
Beispiel #2
0
    def create_with(deployment_host_config):
        host_controller = RemoteHostController()

        return LinuxHost(
            DeploymentUserVerifier(AkvoPermissions(host_controller)),
            PythonInstaller.create_with(host_controller),
            UbuntuPackageInspector(host_controller),
            LinuxPackageVerifier.create_with(host_controller),
            SystemPythonPackageInstaller.create_with(deployment_host_config,
                                                     host_controller),
            host_controller.feedback)
    def setUp(self):
        super(UbuntuPackageInspectorTest, self).setUp()
        self.mock_host_controller = self.mox.CreateMock(RemoteHostController)

        self.package_inspector = UbuntuPackageInspector(
            self.mock_host_controller)