diff --git a/CHANGELOG.md b/CHANGELOG.md index 3050307..7499f9e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,11 @@ Changes ======= +Beta 0.6.1 +---------- +Bug fixes: +* Fixed issue where starting a batch upload from the command line would crash instead of running. + Beta 0.6.0 ---------- Added functionality: diff --git a/iridauploader/__init__.py b/iridauploader/__init__.py index ce3f81e..41d8aad 100644 --- a/iridauploader/__init__.py +++ b/iridauploader/__init__.py @@ -1 +1 @@ -VERSION_NUMBER = "0.6.0" +VERSION_NUMBER = "0.6.1" diff --git a/iridauploader/core/cli.py b/iridauploader/core/cli.py index 0874899..b2ea1a7 100644 --- a/iridauploader/core/cli.py +++ b/iridauploader/core/cli.py @@ -232,7 +232,7 @@ def main(): # Start Upload if args.batch: - return upload_batch(args.directory, args.force, args.upload_mode, args.coninue_partial) + return upload_batch(args.directory, args.force, args.upload_mode, args.continue_partial) else: return upload(args.directory, args.force, args.upload_mode, args.continue_partial) diff --git a/iridauploader/tests/core/test_cli.py b/iridauploader/tests/core/test_cli.py new file mode 100644 index 0000000..a16ae23 --- /dev/null +++ b/iridauploader/tests/core/test_cli.py @@ -0,0 +1,122 @@ +import unittest +from unittest.mock import patch +from os import path + +from iridauploader.core import cli + +path_to_module = path.abspath(path.dirname(__file__)) +if len(path_to_module) == 0: + path_to_module = '.' + + +class TestCliEntryPoints(unittest.TestCase): + """ + Tests the core.cli package entry points into core.upload via main() + """ + + def setUp(self): + print("\nStarting " + self.__module__ + ": " + self._testMethodName) + + @patch("iridauploader.core.upload.upload_run_single_entry") + @patch("iridauploader.core.cli._config_uploader") + @patch("iridauploader.core.cli.init_argparser") + def test_upload_regular(self, mock_init_argparser, mock_configure_uploader, mock_upload_run_single_entry): + + class StubArgs: + """ + Contains dummy properties that mimic the actual arguments object + """ + @property + def directory(self): + return path_to_module + + @property + def force(self): + return False + + @property + def continue_partial(self): + return False + + @property + def batch(self): + return False + + @property + def upload_mode(self): + return None + + stub_args_object = StubArgs() + # stub_argparser returns the above args object + stub_argparser = unittest.mock.MagicMock() + stub_argparser.parse_args.side_effect = [stub_args_object] + # mock_init_argparser returns the above stub_argparser, which contains the args object + mock_init_argparser.side_effect = [stub_argparser] + + mock_configure_uploader.side_effect = [None] + # mock the core code exiting + stub_upload_exit = unittest.mock.MagicMock() + stub_upload_exit.exit_code.side_effect = 0 + mock_upload_run_single_entry.side_effect = [stub_upload_exit] + + cli.main() + + # ensure the configuration is called + mock_configure_uploader.assert_called_once_with(stub_args_object) + # Verify final call + mock_upload_run_single_entry.assert_called_once_with(stub_args_object.directory, + stub_args_object.force, + stub_args_object.upload_mode, + stub_args_object.continue_partial) + + @patch("iridauploader.core.upload.batch_upload_single_entry") + @patch("iridauploader.core.cli._config_uploader") + @patch("iridauploader.core.cli.init_argparser") + def test_upload_batch(self, mock_init_argparser, mock_configure_uploader, mock_batch_upload_single_entry): + + class StubArgs: + """ + Contains dummy properties that mimic the actual arguments object + """ + @property + def directory(self): + return path_to_module + + @property + def force(self): + return False + + @property + def continue_partial(self): + return False + + @property + def batch(self): + return True + + @property + def upload_mode(self): + return None + + stub_args_object = StubArgs() + # stub_argparser returns the above args object + stub_argparser = unittest.mock.MagicMock() + stub_argparser.parse_args.side_effect = [stub_args_object] + # mock_init_argparser returns the above stub_argparser, which contains the args object + mock_init_argparser.side_effect = [stub_argparser] + + mock_configure_uploader.side_effect = [None] + # mock the core code exiting + stub_upload_exit = unittest.mock.MagicMock() + stub_upload_exit.exit_code.side_effect = 0 + mock_batch_upload_single_entry.side_effect = [stub_upload_exit] + + cli.main() + + # ensure the configuration is called + mock_configure_uploader.assert_called_once_with(stub_args_object) + # Verify final call + mock_batch_upload_single_entry.assert_called_once_with(stub_args_object.directory, + stub_args_object.force, + stub_args_object.upload_mode, + stub_args_object.continue_partial) diff --git a/setup.py b/setup.py index ef23ffb..134a935 100644 --- a/setup.py +++ b/setup.py @@ -6,7 +6,7 @@ setuptools.setup( name='iridauploader', - version='0.6.0', + version='0.6.1', description='IRIDA uploader: upload NGS data to IRIDA system', url='https://github.com/phac-nml/irida-uploader', author='Jeffrey Thiessen', diff --git a/windows-installer.cfg b/windows-installer.cfg index f377223..cc394a6 100644 --- a/windows-installer.cfg +++ b/windows-installer.cfg @@ -1,6 +1,6 @@ [Application] name=IRIDA Uploader GUI -version=0.6.0 +version=0.6.1 entry_point=iridauploader.gui.gui:main icon=iridauploader/gui/images/icon.ico # Uncomment this to have a console show alongside the application