From 77e048f6de2982f71ee039da9b9fe3fafdcfc910 Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Fri, 16 Dec 2016 00:01:15 +0200 Subject: [PATCH] Fix the tests --- tests/functional/test_init.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/functional/test_init.py b/tests/functional/test_init.py index 825de57f3..504489416 100644 --- a/tests/functional/test_init.py +++ b/tests/functional/test_init.py @@ -102,7 +102,7 @@ class TestInit(TestCase, TestMixin): mocked_question.return_value = QtWidgets.QMessageBox.No # WHEN: We check if a backup should be created - self.openlp.backup_on_upgrade(old_install) + self.openlp.backup_on_upgrade(old_install, False) # THEN: It should not ask if we want to create a backup self.assertEqual(Settings().value('core/application version'), '2.2.0', 'Version should be the same!') @@ -120,14 +120,18 @@ class TestInit(TestCase, TestMixin): 'build': 'bzr000' } Settings().setValue('core/application version', '2.0.5') + self.openlp.splash = MagicMock() + self.openlp.splash.isVisible.return_value = True with patch('openlp.core.get_application_version') as mocked_get_application_version,\ patch('openlp.core.QtWidgets.QMessageBox.question') as mocked_question: mocked_get_application_version.return_value = MOCKED_VERSION mocked_question.return_value = QtWidgets.QMessageBox.No # WHEN: We check if a backup should be created - self.openlp.backup_on_upgrade(old_install) + self.openlp.backup_on_upgrade(old_install, True) # THEN: It should ask if we want to create a backup self.assertEqual(Settings().value('core/application version'), '2.2.0', 'Version should be upgraded!') self.assertEqual(mocked_question.call_count, 1, 'A question should have been asked!') + self.openlp.splash.hide.assert_called_once_with() + self.openlp.splash.show.assert_called_once_with()