Exemplo n.º 1
0
    def test_import_error(self):
        """If the import fails, destroy the assistant."""

        extract = lambda *a: defer.fail(RuntimeError())
        d = self.humble.step_1(self.dialog, self.model, self.ipath, extract)
        failureResultOf(self, d, RuntimeError)
        self.flushLoggedErrors(RuntimeError)
        self.assertTrue(self.dialog.destroied)
Exemplo n.º 2
0
    def test_import_project_exists(self):
        """
        Import a project but a project with the same name already exists.
        """

        manager = project.ProjectManager(self.mktemp())
        prj = manager.get_project(NAME)
        prj.create()
        d = manager.import_prj(NAME, "/example/test.vbp")
        failureResultOf(self, d, errors.ProjectExistsError)
Exemplo n.º 3
0
    def test_get_real_disk_name(self):
        def raise_IOError():
            raise IOError(-1)

        result = successResultOf(self, self.disk.get_real_disk_name())
        self.assertEqual(result, "")
        self.disk.image = Object()
        self.disk.image.path = "ping"
        result = successResultOf(self, self.disk.get_real_disk_name())
        self.assertEqual(result, "ping")
        self.disk._get_cow_name = raise_IOError
        self.vm.config["private" + self.disk.device] = True
        failureResultOf(self, self.disk.get_real_disk_name(), IOError)
Exemplo n.º 4
0
    def test_create_cow(self):
        settings.set("qemupath", "/supercali")
        failureResultOf(self, self.disk._create_cow("name"),
                        errors.BadConfigError)
        settings.set("qemupath", TEST_DATA_PATH)
        self.disk.image = ImageStub()

        def cb(ret):
            self.fail("cow created, callback called with %s" % ret)

        def eb(failure):
            failure.trap(RuntimeError)

        return self.disk._create_cow("1").addCallbacks(cb, eb)