This commit is contained in:
Tim Bentley 2017-12-20 17:37:58 +00:00
parent d87d8181df
commit 66d450464b
3 changed files with 19 additions and 20 deletions

View File

@ -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"

View File

@ -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'

View File

@ -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')