Changes as requested by @marmarek

This commit is contained in:
Marta Marczykowska-Górecka 2018-09-16 18:04:56 +02:00
parent f99df0d577
commit e18058039f
No known key found for this signature in database
GPG Key ID: 9A752C30B26FD04B
7 changed files with 30 additions and 18 deletions

View File

@ -19,3 +19,15 @@ This will keep translated strings, but will add new ones.
### Updating translations ### Updating translations
Commit updated `.ts` files into `i18n` directory. Commit updated `.ts` files into `i18n` directory.
Tests
----------------------
Located in the tests/ directory.
To run qube manager and backup tests:
python3 test_name.py -v
To run global settings tests:
sudo systemctl stop qubesd; sudo -E python3 test_global_settings.py -v ; sudo systemctl start qubesd

View File

@ -1,5 +0,0 @@
To run qube manager and backup tests:
python3 test_name.py -v
To run global settings tests:
sudo systemctl stop qubesd; sudo -E python3 test_global_settings.py -v ; sudo systemctl start qubesd

View File

@ -2,8 +2,8 @@
# #
# The Qubes OS Project, https://www.qubes-os.org/ # The Qubes OS Project, https://www.qubes-os.org/
# #
# Copyright (C) 2016 Marek Marczykowski-Górecki # Copyright (C) 2016 Marta Marczykowska-Górecka
# <marmarek@invisiblethingslab.com> # <marmarta@invisiblethingslab.com>
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@ -49,10 +49,10 @@ class BackupTest(unittest.TestCase):
del self.qapp del self.qapp
super(BackupTest, self).tearDown() super(BackupTest, self).tearDown()
def test_window_loads(self): def test_00_window_loads(self):
self.assertTrue(self.dialog.select_vms_widget is not None) self.assertTrue(self.dialog.select_vms_widget is not None)
def test_vms_load_correctly(self): def test_01_vms_load_correctly(self):
all_vms = len([vm for vm in self.qapp.domains all_vms = len([vm for vm in self.qapp.domains
if not vm.features.get('internal', False)]) if not vm.features.get('internal', False)])
@ -61,7 +61,7 @@ class BackupTest(unittest.TestCase):
self.assertEqual(all_vms, available_vms + selected_vms) self.assertEqual(all_vms, available_vms + selected_vms)
def test_correct_defaults(self): def test_02_correct_defaults(self):
# backup is compressed # backup is compressed
self.assertTrue(self.dialog.compress_checkbox.isChecked(), self.assertTrue(self.dialog.compress_checkbox.isChecked(),
"Compress backup should be checked by default") "Compress backup should be checked by default")
@ -86,6 +86,7 @@ class BackupTest(unittest.TestCase):
# Check if no default file loads correctly - another file?? # Check if no default file loads correctly - another file??
# TODO: make a separate backup testing file to test various backup defaults # TODO: make a separate backup testing file to test various backup defaults
if __name__ == "__main__": if __name__ == "__main__":
ha_syslog = logging.handlers.SysLogHandler('/dev/log') ha_syslog = logging.handlers.SysLogHandler('/dev/log')
ha_syslog.setFormatter( ha_syslog.setFormatter(

View File

@ -2,8 +2,8 @@
# #
# The Qubes OS Project, https://www.qubes-os.org/ # The Qubes OS Project, https://www.qubes-os.org/
# #
# Copyright (C) 2016 Marek Marczykowski-Górecki # Copyright (C) 2016 Marta Marczykowska-Górecka
# <marmarek@invisiblethingslab.com> # <marmarta@invisiblethingslab.com>
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@ -231,7 +231,7 @@ class GlobalSettingsTest(SystemTestCase):
self.assertEqual(self.app.default_template.name, new_def_template_name) self.assertEqual(self.app.default_template.name, new_def_template_name)
@wrap_in_loop @wrap_in_loop
def test__50_set_default_kernel(self): def test_50_set_default_kernel(self):
new_def_kernel_name = self.__set_noncurrent( new_def_kernel_name = self.__set_noncurrent(
self.dialog.default_kernel_combo) self.dialog.default_kernel_combo)
self.__click_ok() self.__click_ok()

View File

@ -2,8 +2,8 @@
# #
# The Qubes OS Project, https://www.qubes-os.org/ # The Qubes OS Project, https://www.qubes-os.org/
# #
# Copyright (C) 2016 Marek Marczykowski-Górecki # Copyright (C) 2016 Marta Marczykowska-Górecka
# <marmarek@invisiblethingslab.com> # <marmarta@invisiblethingslab.com>
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@ -100,8 +100,6 @@ class QubeManagerTest(unittest.TestCase):
@unittest.mock.patch('qubesmanager.qubesadmin.vm.QubesVM.pause') @unittest.mock.patch('qubesmanager.qubesadmin.vm.QubesVM.pause')
@unittest.mock.patch('qubesmanager.qubesadmin.vm.QubesVM.is_running') @unittest.mock.patch('qubesmanager.qubesadmin.vm.QubesVM.is_running')
@unittest.mock.patch('qubesmanager.qubesadmin.vm.QubesVM.get_power_state') @unittest.mock.patch('qubesmanager.qubesadmin.vm.QubesVM.get_power_state')
def _select_non_admin_vm(self): def _select_non_admin_vm(self):
for row in range(self.dialog.table.rowCount()): for row in range(self.dialog.table.rowCount()):
template = self.dialog.table.item( template = self.dialog.table.item(

View File

@ -113,6 +113,12 @@ rm -rf $RPM_BUILD_ROOT
%{python3_sitelib}/qubesmanager/i18n/qubesmanager_*.qm %{python3_sitelib}/qubesmanager/i18n/qubesmanager_*.qm
%{python3_sitelib}/qubesmanager/i18n/qubesmanager_*.ts %{python3_sitelib}/qubesmanager/i18n/qubesmanager_*.ts
%{python3_sitelib}/qubesmanager/tests/__pycache__
%{python3_sitelib}/qubesmanager/tests/__init__.py
%{python3_sitelib}/qubesmanager/tests/test_backup_01.py
%{python3_sitelib}/qubesmanager/tests/test_global_settings.py
%{python3_sitelib}/qubesmanager/tests/test_qube_manager.py
%dir %{python3_sitelib}/qubesmanager-*.egg-info %dir %{python3_sitelib}/qubesmanager-*.egg-info
%{python3_sitelib}/qubesmanager-*.egg-info/* %{python3_sitelib}/qubesmanager-*.egg-info/*

View File

@ -12,7 +12,7 @@ if __name__ == '__main__':
description='Qubes OS Manager', description='Qubes OS Manager',
license='GPL2+', license='GPL2+',
url='https://www.qubes-os.org/', url='https://www.qubes-os.org/',
packages=setuptools.find_packages(exclude=['qubesmanager.tests']), packages=setuptools.find_packages(),
package_data={ package_data={
'qubesmanager': ['i18n/*'] 'qubesmanager': ['i18n/*']
}, },