Ejemplo n.º 1
0
    def _tear_down_image(self):
        """Tear down the image after the installation."""
        task = TearDownMountTask(self._iso_mount_point)
        self._run_task(task)

        task = TearDownMountTask(self._image_mount_point)
        self._run_task(task)

        task = RemoveImageTask(self._download_path)
        self._run_task(task)
Ejemplo n.º 2
0
    def tear_down_with_tasks(self):
        """Tear down the installation source.

        :return: list of tasks required for the source clean-up
        :rtype: [Task]
        """
        tasks = []
        if self._uses_iso_mount:
            tasks.append(TearDownMountTask(self._iso_mount))
        tasks.append(TearDownMountTask(self._device_mount))
        return tasks
Ejemplo n.º 3
0
    def tear_down_with_tasks(self):
        """Tear down the installation source.

        :return: list of tasks required for the source clean-up
        :rtype: [TearDownMountTask]
        """
        tasks = [
            TearDownMountTask(self._iso_mount),
            TearDownMountTask(self._device_mount),
        ]
        return tasks
Ejemplo n.º 4
0
    def tear_down_with_tasks(self):
        """Tear down the installation source.

        :return: list of tasks required for the source clean-up
        :rtype: [TearDownMountTask]
        """
        return [TearDownMountTask(target_mount=self.mount_point)]
Ejemplo n.º 5
0
    def _tear_down_additional_sources(self):
        """Tear down sources of additional repositories.

        FIXME: This is a temporary workaround.
        """
        while self._mount_points:
            mount_point = self._mount_points.pop()
            task = TearDownMountTask(mount_point)
            task.run()
    def run_failure_test(self, unmount_mock, ismount_mock):
        """Tear down mount source task failure."""
        task = TearDownMountTask(mount_location)
        with self.assertRaises(SourceTearDownError) as cm:
            task.run()

        self.assertEqual(str(cm.exception), "The mount point /some/dir is still in use.")
        unmount_mock.assert_called_once_with(mount_location)
        ismount_mock.assert_called_once_with(mount_location)
Ejemplo n.º 7
0
    def test_run_failure(self, unmount_mock, ismount_mock):
        """Tear down mount source task failure."""
        task = TearDownMountTask(mount_location)
        with pytest.raises(SourceTearDownError) as cm:
            task.run()

        assert str(cm.value) == "The mount point /some/dir is still in use."
        unmount_mock.assert_called_once_with(mount_location)
        ismount_mock.assert_called_once_with(mount_location)
Ejemplo n.º 8
0
 def name_test(self):
     """Tear down mount source task name."""
     task = TearDownMountTask(mount_location)
     self.assertEqual(task.name, "Tear down mount installation source")
Ejemplo n.º 9
0
 def run_success_test(self, unmount_mock):
     """Tear down mount source task execution."""
     task = TearDownMountTask(mount_location)
     task.run()
     unmount_mock.assert_called_once_with(mount_location)
Ejemplo n.º 10
0
 def test_name(self):
     """Tear down mount source task name."""
     task = TearDownMountTask(mount_location)
     assert task.name == "Tear down mount installation source"