This commit is contained in:
Tim Bentley 2017-12-23 09:22:53 +00:00
parent 5e9a73ca9f
commit 35d2ce263e
10 changed files with 23 additions and 24 deletions

View File

@ -141,7 +141,7 @@ class TestCategoryActionList(TestCase):
assert self.action1 not in self.list
# THEN: Check if an exception is raised when trying to remove a not present action.
assertRaises(ValueError, self.list.remove, self.action2)
self.assertRaises(ValueError, self.list.remove, self.action2)
class TestActionList(TestCase, TestMixin):

View File

@ -183,7 +183,7 @@ class TestInit(TestCase, TestMixin):
# WHEN: Calling get_uno_command
# THEN: a FileNotFoundError exception should be raised
assertRaises(FileNotFoundError, get_uno_command)
self.assertRaises(FileNotFoundError, get_uno_command)
def test_get_uno_command_connection_type(self):
"""

View File

@ -159,7 +159,7 @@ class TestProjectorDB(TestCase):
record = self.projector.get_projector_by_ip(TEST2_DATA['ip'])
# THEN: Verify proper record returned
assertTrue(compare_data(Projector(**TEST2_DATA), record),
self.assertTrue(compare_data(Projector(**TEST2_DATA), record),
'Record found should have been test_2 data')
def test_find_record_by_name(self):
@ -173,7 +173,7 @@ class TestProjectorDB(TestCase):
record = self.projector.get_projector_by_name(TEST2_DATA['name'])
# THEN: Verify proper record returned
assertTrue(compare_data(Projector(**TEST2_DATA), record),
self.assertTrue(compare_data(Projector(**TEST2_DATA), record),
'Record found should have been test_2 data')
def test_record_delete(self):
@ -189,7 +189,7 @@ class TestProjectorDB(TestCase):
# THEN: Verify record not retrievable
found = self.projector.get_projector_by_ip(TEST3_DATA['ip'])
assertFalse(found, 'test_3 record should have been deleted')
self.assertFalse(found, 'test_3 record should have been deleted')
def test_record_edit(self):
"""
@ -214,7 +214,7 @@ class TestProjectorDB(TestCase):
record.model_filter = TEST3_DATA['model_filter']
record.model_lamp = TEST3_DATA['model_lamp']
updated = self.projector.update_projector(record)
assertTrue(updated, 'Save updated record should have returned True')
self.assertTrue(updated, 'Save updated record should have returned True')
record = self.projector.get_projector_by_ip(TEST3_DATA['ip'])
# THEN: Record ID should remain the same, but data should be changed

View File

@ -402,7 +402,7 @@ class TestListPreviewWidget(TestCase):
list_preview_widget.row_resized(0, 100, 150)
# THEN: self.cellWidget(row, 0).children()[1].setMaximumWidth() should fail
assertRaises(Exception)
self.assertRaises(Exception)
@patch(u'openlp.core.widgets.views.ListPreviewWidget.selectRow')
@patch(u'openlp.core.widgets.views.ListPreviewWidget.scrollToItem')

View File

@ -58,7 +58,7 @@ class MediaPluginTest(TestCase, TestMixin):
# THEN: about() should return a string object
assert isinstance(MediaPlugin.about(), str)
# THEN: about() should return a non-empty string
self.assertNotEquals(len(MediaPlugin.about()), 0)
assert len(MediaPlugin.about()) is not 0
@patch('openlp.plugins.media.mediaplugin.check_binary_exists')
def test_process_check_binary_pass(self, mocked_checked_binary_exists):

View File

@ -217,7 +217,7 @@ class TestEasyWorshipSongImport(TestCase):
for field_name in non_existing_fields:
# THEN: The importer object should not be None
assertRaises(IndexError, importer.db_find_field, field_name)
self.assertRaises(IndexError, importer.db_find_field, field_name)
def test_set_record_struct(self):
"""

View File

@ -153,9 +153,8 @@ class TestOpenLyricsImport(TestCase, TestMixin):
ol._process_formatting_tags(song_xml, False)
# THEN: New tags should have been saved
assertListEqual(json.loads(json.dumps(result_tags)),
json.loads(str(Settings().value('formattingTags/html_tags'))),
'The formatting tags should contain both the old and the new')
assert json.loads(json.dumps(result_tags)) == json.loads(str(Settings().value('formattingTags/html_tags'))), \
'The formatting tags should contain both the old and the new'
def test_process_author(self):
"""

View File

@ -45,8 +45,8 @@ class TestSongUsage(TestCase):
# THEN: about() should return a string object
assert isinstance(SongUsagePlugin.about(), str)
# THEN: about() should return a non-empty string
assertNotEquals(len(SongUsagePlugin.about()), 0)
assertNotEquals(len(SongUsagePlugin.about()), 0)
assert len(SongUsagePlugin.about()) is not 0
assert len(SongUsagePlugin.about()) is not 0
@patch('openlp.plugins.songusage.songusageplugin.Manager')
def test_song_usage_init(self, MockedManager):

View File

@ -86,11 +86,11 @@ class TestPluginManager(TestCase, TestMixin):
# THEN: We should find the "Songs", "Bibles", etc in the plugins list
plugin_names = [plugin.name for plugin in plugin_manager.plugins]
assertIn('songs', plugin_names, 'There should be a "songs" plugin')
assertIn('bibles', plugin_names, 'There should be a "bibles" plugin')
assertIn('presentations', plugin_names, 'There should be a "presentations" plugin')
assertIn('images', plugin_names, 'There should be a "images" plugin')
assertIn('media', plugin_names, 'There should be a "media" plugin')
assertIn('custom', plugin_names, 'There should be a "custom" plugin')
assertIn('songusage', plugin_names, 'There should be a "songusage" plugin')
assertIn('alerts', plugin_names, 'There should be a "alerts" plugin')
assert 'songs' in plugin_names, 'There should be a "songs" plugin'
assert 'bibles' in plugin_names, 'There should be a "bibles" plugin'
assert 'presentations' in plugin_names, 'There should be a "presentations" plugin'
assert 'images' in plugin_names, 'There should be a "images" plugin'
assert 'media' in plugin_names, 'There should be a "media" plugin'
assert 'custom' in plugin_names, 'There should be a "custom" plugin'
assert 'songusage'in plugin_names, 'There should be a "songusage" plugin'
assert 'alerts' in plugin_names, 'There should be a "alerts" plugin'

View File

@ -470,7 +470,7 @@ class TestServiceManager(TestCase, TestMixin):
selected_index = self.service_manager.service_manager_list.currentIndex()
assert self.service_manager.service_manager_list.isExpanded(selected_index) is False, \
'Item should have been collapsed'
assert self.service_manager.service_manager_list.currentItem() == song_item is True, \
assert self.service_manager.service_manager_list.currentItem() == song_item, \
'Top item should have been selected'
self.service_manager.collapsed.assert_called_once_with(song_item)
@ -493,6 +493,6 @@ class TestServiceManager(TestCase, TestMixin):
selected_index = self.service_manager.service_manager_list.currentIndex()
assert self.service_manager.service_manager_list.isExpanded(selected_index) is False, \
'Item should have been collapsed'
assert self.service_manager.service_manager_list.currentItem() == song_item is True, \
assert self.service_manager.service_manager_list.currentItem() == song_item, \
'Top item should have been selected'
self.service_manager.collapsed.assert_called_once_with(song_item)