diff --git a/openlp/core/app.py b/openlp/core/app.py index 29d4fdea1..252c14d55 100644 --- a/openlp/core/app.py +++ b/openlp/core/app.py @@ -142,6 +142,7 @@ class OpenLP(QtWidgets.QApplication): """ QtWidgets.QMessageBox.critical(None, UiStrings().Error, UiStrings().OpenLPStart, QtWidgets.QMessageBox.StandardButtons(QtWidgets.QMessageBox.Ok)) + @staticmethod def is_data_path_missing(): """ @@ -293,8 +294,7 @@ def parse_options(args=None): parser.add_argument('-l', '--log-level', dest='loglevel', default='warning', metavar='LEVEL', help='Set logging to LEVEL level. Valid values are "debug", "info", "warning".') parser.add_argument('-p', '--portable', dest='portable', action='store_true', - help='Specify if this should be run as a portable app, ' - 'off a USB flash drive (not implemented).') + help='Specify if this should be run as a portable app, ') parser.add_argument('-w', '--no-web-server', dest='no_web_server', action='store_true', help='Turn off the Web and Socket Server ') parser.add_argument('rargs', nargs='?', default=[]) diff --git a/tests/functional/openlp_core/test_app.py b/tests/functional/openlp_core/test_app.py index 743dfe313..65fb92003 100644 --- a/tests/functional/openlp_core/test_app.py +++ b/tests/functional/openlp_core/test_app.py @@ -138,13 +138,11 @@ class TestOpenLP(TestCase, TestMixin): Test the OpenLP app class """ def setUp(self): + self.setup_application() self.build_settings() - # self.qapplication_patcher = patch('openlp.core.app.QtGui.QApplication') - # self.mocked_qapplication = self.qapplication_patcher.start() self.openlp = OpenLP([]) def tearDown(self): - # self.qapplication_patcher.stop() self.destroy_settings() del self.openlp self.openlp = None @@ -165,55 +163,21 @@ class TestOpenLP(TestCase, TestMixin): self.mocked_qapplication.exec.assert_called_once_with() assert result is False - @skip("This one fails") @patch('openlp.core.app.QtWidgets.QMessageBox.critical') @patch('openlp.core.app.QtWidgets.QMessageBox.StandardButtons') - @patch('openlp.core.app.QtCore.QSharedMemory') - def test_is_already_running_is_running_continue(self, MockedSharedMemory, MockedStandardButtons, mocked_critical): + def test_is_already_running_is_running(self, MockedStandardButtons, mocked_critical): """ Test the is_already_running() method when OpenLP IS running and the user chooses to continue """ # GIVEN: An OpenLP app and some mocks - mocked_shared_memory = MagicMock() - mocked_shared_memory.attach.return_value = True - MockedSharedMemory.return_value = mocked_shared_memory MockedStandardButtons.return_value = 0 - mocked_critical.return_value = QtWidgets.QMessageBox.Yes + mocked_critical.return_value = QtWidgets.QMessageBox.Ok # WHEN: is_already_running() is called - result = self.openlp.is_already_running() + self.openlp.is_already_running() # THEN: The result should be false - MockedSharedMemory.assert_called_once_with('OpenLP') - mocked_shared_memory.attach.assert_called_once_with() - MockedStandardButtons.assert_called_once_with(QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No) - mocked_critical.assert_called_once_with(None, 'Error', 'OpenLP is already running. Do you wish to continue?', 0) - assert result is False - - @skip("This one fails") - @patch('openlp.core.app.QtWidgets.QMessageBox.critical') - @patch('openlp.core.app.QtWidgets.QMessageBox.StandardButtons') - @patch('openlp.core.app.QtCore.QSharedMemory') - def test_is_already_running_is_running_stop(self, MockedSharedMemory, MockedStandardButtons, mocked_critical): - """ - Test the is_already_running() method when OpenLP IS running and the user chooses to stop - """ - # GIVEN: An OpenLP app and some mocks - mocked_shared_memory = MagicMock() - mocked_shared_memory.attach.return_value = True - MockedSharedMemory.return_value = mocked_shared_memory - MockedStandardButtons.return_value = 0 - mocked_critical.return_value = QtWidgets.QMessageBox.No - - # WHEN: is_already_running() is called - result = self.openlp.is_already_running() - - # THEN: The result should be false - MockedSharedMemory.assert_called_once_with('OpenLP') - mocked_shared_memory.attach.assert_called_once_with() - MockedStandardButtons.assert_called_once_with(QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No) - mocked_critical.assert_called_once_with(None, 'Error', 'OpenLP is already running. Do you wish to continue?', 0) - assert result is True + MockedStandardButtons.assert_called_once_with(QtWidgets.QMessageBox.Ok) @skip("This one fails") def test_process_events(self):