def setUp(self):
        super(CloneVMTest, self).setUp()
        self.qtapp, self.loop = init_qtapp()

        self.qapp = Qubes()

        # mock up the Create VM Thread to avoid changing system state
        self.patcher_thread = unittest.mock.patch(
            'qubesmanager.common_threads.CloneVMThread')
        self.mock_thread = self.patcher_thread.start()
        self.addCleanup(self.patcher_thread.stop)

        # mock the progress dialog to speed testing up
        self.patcher_progress = unittest.mock.patch(
            'PyQt5.QtWidgets.QProgressDialog')
        self.mock_progress = self.patcher_progress.start()
        self.addCleanup(self.patcher_progress.stop)

        # mock the progress dialog to speed testing up
        self.patcher_warning = unittest.mock.patch(
            'PyQt5.QtWidgets.QMessageBox.warning')
        self.mock_warning = self.patcher_warning.start()
        self.addCleanup(self.patcher_warning.stop)

        self.dialog = clone_vm.CloneVMDlg(self.qtapp, self.qapp)
Beispiel #2
0
    def setUp(self):
        super(GlobalSettingsTest, self).setUp()
        self.qtapp, self.loop = init_qtapp()

        self.qapp = Qubes()
        self.dialog = global_settings.GlobalSettingsWindow(
            self.qtapp, self.qapp)

        self.setattr_patcher = unittest.mock.patch.object(
            type(self.dialog.qubes_app), "__setattr__")
        self.setattr_mock = self.setattr_patcher.start()
        self.addCleanup(self.setattr_patcher.stop)
Beispiel #3
0
    def setUp(self):
        super(VMSettingsTest, self).setUp()
        self.qtapp, self.loop = init_qtapp()

        self.mock_qprogress = unittest.mock.patch(
            'PyQt5.QtWidgets.QProgressDialog')
        self.mock_qprogress.start()

        self.addCleanup(self.mock_qprogress.stop)

        self.qapp = Qubes()

        if "test-vm" in self.qapp.domains:
            del self.qapp.domains["test-vm"]
    def setUp(self):
        super(NewVmTest, self).setUp()
        self.qtapp, self.loop = init_qtapp()

        self.qapp = Qubes()

        # mock up the Create VM Thread to avoid changing system state
        self.patcher_thread = unittest.mock.patch(
            'qubesmanager.create_new_vm.CreateVMThread')
        self.mock_thread = self.patcher_thread.start()
        self.addCleanup(self.patcher_thread.stop)

        # mock the progress dialog to speed testing up
        self.patcher_progress = unittest.mock.patch(
            'PyQt5.QtWidgets.QProgressDialog')
        self.mock_progress = self.patcher_progress.start()
        self.addCleanup(self.patcher_progress.stop)

        self.dialog = create_new_vm.NewVmDlg(self.qtapp, self.qapp)
Beispiel #5
0
    def setUp(self):
        super(BackupTest, self).setUp()
        self.qtapp, self.loop = init_qtapp()

        # mock up nonexistence of saved backup settings
        self.patcher_open = unittest.mock.patch('builtins.open')
        self.mock_open = self.patcher_open.start()
        self.mock_open.side_effect = FileNotFoundError()
        self.addCleanup(self.patcher_open.stop)

        # mock up the Backup Thread to avoid accidentally changing system state
        self.patcher_thread = unittest.mock.patch(
            'qubesmanager.backup.BackupThread')
        self.mock_thread = self.patcher_thread.start()
        self.addCleanup(self.patcher_thread.stop)

        self.qapp = Qubes()
        self.dispatcher = events.EventsDispatcher(self.qapp)

        self.dialog = backup.BackupVMsWindow(
            self.qtapp, self.qapp, self.dispatcher)
        self.dialog.show()
Beispiel #6
0
 def setUp(self):
     super(BackupUtilsTest, self).setUp()
     self.qtapp, self.loop = init_qtapp()
     self.qapp = Qubes()