From 66d450464bf42189f5b4c5ef2e99e1c3573f08ee Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Wed, 20 Dec 2017 17:37:58 +0000 Subject: [PATCH] start ui --- .../openlp_core/ui/test_aboutform.py | 7 +++--- .../openlp_core/ui/test_advancedtab.py | 8 +++---- .../openlp_core/ui/test_firsttimeform.py | 24 +++++++++---------- 3 files changed, 19 insertions(+), 20 deletions(-) diff --git a/tests/functional/openlp_core/ui/test_aboutform.py b/tests/functional/openlp_core/ui/test_aboutform.py index 0cba7b008..e90764e88 100644 --- a/tests/functional/openlp_core/ui/test_aboutform.py +++ b/tests/functional/openlp_core/ui/test_aboutform.py @@ -59,8 +59,8 @@ class TestFirstTimeForm(TestCase, TestMixin): about_form = AboutForm(None) # THEN: The build number should be in the text - self.assertTrue('OpenLP 3.1.5 build 3000' in about_form.about_text_edit.toPlainText(), - "The build number should be set correctly") + assert 'OpenLP 3.1.5 build 3000' in about_form.about_text_edit.toPlainText(), \ + "The build number should be set correctly" def test_about_form_date(self): """ @@ -74,5 +74,4 @@ class TestFirstTimeForm(TestCase, TestMixin): license_text = about_form.license_text_edit.toPlainText() # THEN: The date should be in the text twice. - self.assertTrue(license_text.count(date_string, 0) == 2, - "The text string should be added twice to the license string") + assert license_text.count(date_string, 0) == 2, "The text string should be added twice to the license string" diff --git a/tests/functional/openlp_core/ui/test_advancedtab.py b/tests/functional/openlp_core/ui/test_advancedtab.py index ca7bb8ca5..52cf2068f 100644 --- a/tests/functional/openlp_core/ui/test_advancedtab.py +++ b/tests/functional/openlp_core/ui/test_advancedtab.py @@ -50,7 +50,7 @@ class TestAdvancedTab(TestCase, TestMixin): advanced_tab = AdvancedTab(settings_form) # THEN: - self.assertEqual("Advanced", advanced_tab.tab_title, 'The tab title should be Advanced') + assert "Advanced" == advanced_tab.tab_title, 'The tab title should be Advanced' def test_change_search_as_type(self): """ @@ -64,6 +64,6 @@ class TestAdvancedTab(TestCase, TestMixin): advanced_tab.on_search_as_type_check_box_changed(True) # THEN: we should have two post save processed to run - self.assertEqual(2, len(settings_form.processes), 'Two post save processes should be created') - self.assertTrue("songs_config_updated" in settings_form.processes, 'The songs plugin should be called') - self.assertTrue("custom_config_updated" in settings_form.processes, 'The custom plugin should be called') + assert 2 == len(settings_form.processes), 'Two post save processes should be created' + assert "songs_config_updated" in settings_form.processes, 'The songs plugin should be called' + assert "custom_config_updated" in settings_form.processes, 'The custom plugin should be called' diff --git a/tests/functional/openlp_core/ui/test_firsttimeform.py b/tests/functional/openlp_core/ui/test_firsttimeform.py index 543d4334c..2629eaa37 100644 --- a/tests/functional/openlp_core/ui/test_firsttimeform.py +++ b/tests/functional/openlp_core/ui/test_firsttimeform.py @@ -90,12 +90,12 @@ class TestFirstTimeForm(TestCase, TestMixin): frw.initialize(expected_screens) # THEN: The screens should be set up, and the default values initialised - self.assertEqual(expected_screens, frw.screens, 'The screens should be correct') - self.assertTrue(frw.web_access, 'The default value of self.web_access should be True') - self.assertFalse(frw.was_cancelled, 'The default value of self.was_cancelled should be False') - self.assertListEqual([], frw.theme_screenshot_threads, 'The list of threads should be empty') - self.assertListEqual([], frw.theme_screenshot_workers, 'The list of workers should be empty') - self.assertFalse(frw.has_run_wizard, 'has_run_wizard should be False') + assert expected_screens == frw.screens, 'The screens should be correct' + assert frw.web_access is True, 'The default value of self.web_access should be True' + assert frw.was_cancelled is False, 'The default value of self.was_cancelled should be False' + assert [] == frw.theme_screenshot_threads, 'The list of threads should be empty' + assert [] == frw.theme_screenshot_workers, 'The list of workers should be empty' + assert frw.has_run_wizard is False, 'has_run_wizard should be False' def test_set_defaults(self): """ @@ -124,7 +124,7 @@ class TestFirstTimeForm(TestCase, TestMixin): # THEN: The default values should have been set mocked_restart.assert_called_with() - self.assertEqual('http://openlp.org/files/frw/', frw.web, 'The default URL should be set') + assert 'http://openlp.org/files/frw/' == frw.web, 'The default URL should be set' mocked_cancel_button.clicked.connect.assert_called_with(frw.on_cancel_button_clicked) mocked_no_internet_finish_btn.clicked.connect.assert_called_with(frw.on_no_internet_finish_button_clicked) mocked_currentIdChanged.connect.assert_called_with(frw.on_current_id_changed) @@ -176,12 +176,12 @@ class TestFirstTimeForm(TestCase, TestMixin): frw.on_cancel_button_clicked() # THEN: The right things should be called in the right order - self.assertTrue(frw.was_cancelled, 'The was_cancelled property should have been set to True') + assert frw.was_cancelled is True, 'The was_cancelled property should have been set to True' mocked_worker.set_download_canceled.assert_called_with(True) mocked_thread.isRunning.assert_called_with() - self.assertEqual(2, mocked_thread.isRunning.call_count, 'isRunning() should have been called twice') + assert 2 == mocked_thread.isRunning.call_count, 'isRunning() should have been called twice' mocked_time.sleep.assert_called_with(0.1) - self.assertEqual(1, mocked_time.sleep.call_count, 'sleep() should have only been called once') + assert 1 == mocked_time.sleep.call_count, 'sleep() should have only been called once' mocked_set_normal_cursor.assert_called_with() def test_broken_config(self): @@ -198,7 +198,7 @@ class TestFirstTimeForm(TestCase, TestMixin): first_time_form._download_index() # THEN: The First Time Form should not have web access - self.assertFalse(first_time_form.web_access, 'There should not be web access with a broken config file') + assert first_time_form.web_access is False, 'There should not be web access with a broken config file' def test_invalid_config(self): """ @@ -214,7 +214,7 @@ class TestFirstTimeForm(TestCase, TestMixin): first_time_form._download_index() # THEN: The First Time Form should not have web access - self.assertFalse(first_time_form.web_access, 'There should not be web access with an invalid config file') + assert first_time_form.web_access is False, 'There should not be web access with an invalid config file' @patch('openlp.core.ui.firsttimeform.get_web_page') @patch('openlp.core.ui.firsttimeform.QtWidgets.QMessageBox')