@@ -0,0 +1,2861 @@
+# -*- encoding: utf8 -*-%0A#%0A# The Qubes OS Project, http://www.qubes-os.org%0A#%0A# Copyright (C) 2017 Marek Marczykowski-G%C3%B3recki%0A#                               %3Cmarmarek@invisiblethingslab.com%3E%0A#%0A# This program is free software; you can redistribute it and/or modify%0A# it under the terms of the GNU Lesser General Public License as published by%0A# the Free Software Foundation; either version 2.1 of the License, or%0A# (at your option) any later version.%0A#%0A# This program is distributed in the hope that it will be useful,%0A# but WITHOUT ANY WARRANTY; without even the implied warranty of%0A# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the%0A# GNU Lesser General Public License for more details.%0A#%0A# You should have received a copy of the GNU Lesser General Public License along%0A# with this program; if not, see %3Chttp://www.gnu.org/licenses/%3E.%0A%0Aimport qubesmgmt.tests%0Aimport qubesmgmt.tests.tools%0Aimport qubesmgmt.tools.qubes_prefs%0A%0A%0Aclass TC_00_qubes_prefs(qubesmgmt.tests.QubesTestCase):%0A    def test_000_list(self):%0A        self.app.expected_calls%5B%0A            ('dom0', 'mgmt.global.property.List', None, None)%5D = %5C%0A            b'0%5Cx00prop1%5Cnprop2%5Cn'%0A        self.app.expected_calls%5B%0A            ('dom0', 'mgmt.global.property.Get', 'prop1', None)%5D = %5C%0A            b'0%5Cx00default=True %5C'value1%5C''%0A        self.app.expected_calls%5B%0A            ('dom0', 'mgmt.global.property.Get', 'prop2', None)%5D = %5C%0A            b'0%5Cx00default=False %5C'value2%5C''%0A        with qubesmgmt.tests.tools.StdoutBuffer() as stdout:%0A            self.assertEqual(0, qubesmgmt.tools.qubes_prefs.main(%5B%5D, app=self.app))%0A        self.assertEqual(stdout.getvalue(),%0A            'prop1  D  value1%5Cn'%0A            'prop2  -  value2%5Cn')%0A        self.assertAllCalled()%0A%0A    def test_002_set_property(self):%0A        self.app.expected_calls%5B%0A            ('dom0', 'mgmt.global.property.Set', 'default_user', b'testuser')%5D%5C%0A            = b'0%5Cx00'%0A        self.assertEqual(0, qubesmgmt.tools.qubes_prefs.main(%5B%0A            'default_user', 'testuser'%5D, app=self.app))%0A        self.assertAllCalled()%0A%0A    def test_003_invalid_property(self):%0A        self.app.expected_calls%5B%0A            ('dom0', 'mgmt.global.property.Get', 'no_such_property', None)%5D = %5C%0A            b'2%5Cx00AttributeError%5Cx00%5Cx00no_such_property%5Cx00'%0A        with self.assertRaises(SystemExit):%0A            qubesmgmt.tools.qubes_prefs.main(%5B%0A                'no_such_property'%5D, app=self.app)%0A        self.assertAllCalled()%0A%0A    def test_004_set_invalid_property(self):%0A        self.app.expected_calls%5B%0A            ('dom0', 'mgmt.global.property.Set', 'no_such_property', b'value')%5D%5C%0A            = b'2%5Cx00AttributeError%5Cx00%5Cx00no_such_property%5Cx00'%0A        with self.assertRaises(SystemExit):%0A            qubesmgmt.tools.qubes_prefs.main(%5B%0A                'no_such_property', 'value'%5D, app=self.app)%0A        self.assertAllCalled()%0A

add qubes-prefs tests