Пример #1
0
    def test_show_missing(self):
        """
        show_missing is a new option, don't raise an exception if it is not found.
        """

        s = _settings.Settings(self.filename)
        s.load()
        self.assertEqual(s.get("show_missing"), True)
Пример #2
0
    def test_workspace(self):
        """
        workspace is a new option, don't raise an exception if it is not found.
        """

        s = _settings.Settings(self.filename)
        s.load()
        self.assertEqual(s.get("workspace"), _settings.DEFAULT_WORKSPACE)
Пример #3
0
    def test_cowfmt(self):
        """
        cowfmt is a new option, don't raise an exception if it is not found.
        """

        s = _settings.Settings(self.filename)
        s.load()
        self.assertEqual(s.get("cowfmt"), "qcow2")
Пример #4
0
    def test_create_settings_if_not_exists(self):
        """
        If the settings file does not exist, create it with reasonable values.
        """

        filename = self.mktemp()
        self.assertFalse(os.path.isfile(filename))
        s = _settings.Settings(filename)
        s.load()
        self.assertTrue(os.path.isfile(filename))
Пример #5
0
 def test_quit(self):
     DESC = "test"
     PROJECT = "test_project"
     factory = stubs.Factory()
     manager = project.ProjectManager(self.mktemp())
     prj = manager.get_project(PROJECT)
     prj.create()
     prj.open(factory, _settings.Settings(self.mktemp()))
     readme_tab = Readme(manager)
     readme_tab.init(factory)
     readme_tab.set_text(DESC)
     self.assertEqual(prj.get_description(), "")
     readme_tab.on_quit(factory)
     self.assertEqual(prj.get_description(), DESC)
Пример #6
0
# -*- test-case-name: virtualbricks.tests.test_settings -*-
# Virtualbricks - a vde/qemu gui written in python and GTK/Glade.
# Copyright (C) 2018 Virtualbricks team

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

import sys
del sys.modules["virtualbricks.settings"]
from virtualbricks import _settings
_settings.install(_settings.Settings())