forked from openlp/openlp
Fix up tests
This commit is contained in:
parent
7aa7e5c635
commit
1d736a58f5
@ -1356,6 +1356,8 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow, LogMixin, RegistryPropert
|
||||
def open_cmd_line_files(self, args):
|
||||
"""
|
||||
Open files passed in through command line arguments
|
||||
|
||||
:param list[str] args: List of remaining positionall arguments
|
||||
"""
|
||||
for arg in args:
|
||||
file_name = os.path.expanduser(arg)
|
||||
|
@ -88,7 +88,7 @@ class TestCommonFunctions(TestCase):
|
||||
extension_loader('glob')
|
||||
|
||||
# THEN: The `ImportError` should be caught and logged
|
||||
assert mocked_logger.warning.called
|
||||
assert mocked_logger.exception.called
|
||||
|
||||
def test_extension_loader_os_error(self):
|
||||
"""
|
||||
@ -106,7 +106,7 @@ class TestCommonFunctions(TestCase):
|
||||
extension_loader('glob')
|
||||
|
||||
# THEN: The `OSError` should be caught and logged
|
||||
assert mocked_logger.warning.called
|
||||
assert mocked_logger.exception.called
|
||||
|
||||
def test_de_hump_conversion(self):
|
||||
"""
|
||||
|
@ -138,7 +138,7 @@ def test_parse_options_file():
|
||||
assert args.loglevel == 'warning', 'The log level should be set to warning'
|
||||
assert args.no_error_form is False, 'The no_error_form should be set to False'
|
||||
assert args.portable is False, 'The portable flag should be set to false'
|
||||
assert args.rargs == 'dummy_temp', 'The service file should not be blank'
|
||||
assert args.rargs == ['dummy_temp'], 'The service file should not be blank'
|
||||
|
||||
|
||||
def test_parse_options_file_and_debug():
|
||||
@ -155,7 +155,7 @@ def test_parse_options_file_and_debug():
|
||||
assert args.loglevel == ' debug', 'The log level should be set to debug'
|
||||
assert args.no_error_form is False, 'The no_error_form should be set to False'
|
||||
assert args.portable is False, 'The portable flag should be set to false'
|
||||
assert args.rargs == 'dummy_temp', 'The service file should not be blank'
|
||||
assert args.rargs == ['dummy_temp'], 'The service file should not be blank'
|
||||
|
||||
|
||||
@skip('Figure out why this is causing a segfault')
|
||||
|
@ -96,7 +96,7 @@ class TestMainWindow(TestCase, TestMixin):
|
||||
|
||||
# WHEN the argument is processed
|
||||
with patch.object(self.main_window.service_manager, 'load_file') as mocked_load_file:
|
||||
self.main_window.open_cmd_line_files(service)
|
||||
self.main_window.open_cmd_line_files([service])
|
||||
|
||||
# THEN the service from the arguments is loaded
|
||||
mocked_load_file.assert_called_with(Path(service))
|
||||
|
@ -136,8 +136,7 @@ class TestCSVImport(TestCase):
|
||||
mocked_enter_file = MagicMock()
|
||||
mocked_csv_file.open.return_value.__enter__.return_value = mocked_enter_file
|
||||
|
||||
with patch('openlp.plugins.bibles.lib.importers.csvbible.get_file_encoding',
|
||||
return_value={'encoding': 'utf-8', 'confidence': 0.99}), \
|
||||
with patch('openlp.plugins.bibles.lib.importers.csvbible.get_file_encoding', return_value='utf-8'), \
|
||||
patch('openlp.plugins.bibles.lib.importers.csvbible.csv.reader',
|
||||
return_value=iter(test_data)) as mocked_reader:
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user