forked from openlp/openlp
finished
This commit is contained in:
parent
5e9a73ca9f
commit
35d2ce263e
@ -141,7 +141,7 @@ class TestCategoryActionList(TestCase):
|
|||||||
assert self.action1 not in self.list
|
assert self.action1 not in self.list
|
||||||
|
|
||||||
# THEN: Check if an exception is raised when trying to remove a not present action.
|
# 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):
|
class TestActionList(TestCase, TestMixin):
|
||||||
|
@ -183,7 +183,7 @@ class TestInit(TestCase, TestMixin):
|
|||||||
# WHEN: Calling get_uno_command
|
# WHEN: Calling get_uno_command
|
||||||
|
|
||||||
# THEN: a FileNotFoundError exception should be raised
|
# 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):
|
def test_get_uno_command_connection_type(self):
|
||||||
"""
|
"""
|
||||||
|
@ -159,7 +159,7 @@ class TestProjectorDB(TestCase):
|
|||||||
record = self.projector.get_projector_by_ip(TEST2_DATA['ip'])
|
record = self.projector.get_projector_by_ip(TEST2_DATA['ip'])
|
||||||
|
|
||||||
# THEN: Verify proper record returned
|
# 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')
|
'Record found should have been test_2 data')
|
||||||
|
|
||||||
def test_find_record_by_name(self):
|
def test_find_record_by_name(self):
|
||||||
@ -173,7 +173,7 @@ class TestProjectorDB(TestCase):
|
|||||||
record = self.projector.get_projector_by_name(TEST2_DATA['name'])
|
record = self.projector.get_projector_by_name(TEST2_DATA['name'])
|
||||||
|
|
||||||
# THEN: Verify proper record returned
|
# 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')
|
'Record found should have been test_2 data')
|
||||||
|
|
||||||
def test_record_delete(self):
|
def test_record_delete(self):
|
||||||
@ -189,7 +189,7 @@ class TestProjectorDB(TestCase):
|
|||||||
|
|
||||||
# THEN: Verify record not retrievable
|
# THEN: Verify record not retrievable
|
||||||
found = self.projector.get_projector_by_ip(TEST3_DATA['ip'])
|
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):
|
def test_record_edit(self):
|
||||||
"""
|
"""
|
||||||
@ -214,7 +214,7 @@ class TestProjectorDB(TestCase):
|
|||||||
record.model_filter = TEST3_DATA['model_filter']
|
record.model_filter = TEST3_DATA['model_filter']
|
||||||
record.model_lamp = TEST3_DATA['model_lamp']
|
record.model_lamp = TEST3_DATA['model_lamp']
|
||||||
updated = self.projector.update_projector(record)
|
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'])
|
record = self.projector.get_projector_by_ip(TEST3_DATA['ip'])
|
||||||
|
|
||||||
# THEN: Record ID should remain the same, but data should be changed
|
# THEN: Record ID should remain the same, but data should be changed
|
||||||
|
@ -402,7 +402,7 @@ class TestListPreviewWidget(TestCase):
|
|||||||
list_preview_widget.row_resized(0, 100, 150)
|
list_preview_widget.row_resized(0, 100, 150)
|
||||||
|
|
||||||
# THEN: self.cellWidget(row, 0).children()[1].setMaximumWidth() should fail
|
# 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.selectRow')
|
||||||
@patch(u'openlp.core.widgets.views.ListPreviewWidget.scrollToItem')
|
@patch(u'openlp.core.widgets.views.ListPreviewWidget.scrollToItem')
|
||||||
|
@ -58,7 +58,7 @@ class MediaPluginTest(TestCase, TestMixin):
|
|||||||
# THEN: about() should return a string object
|
# THEN: about() should return a string object
|
||||||
assert isinstance(MediaPlugin.about(), str)
|
assert isinstance(MediaPlugin.about(), str)
|
||||||
# THEN: about() should return a non-empty string
|
# 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')
|
@patch('openlp.plugins.media.mediaplugin.check_binary_exists')
|
||||||
def test_process_check_binary_pass(self, mocked_checked_binary_exists):
|
def test_process_check_binary_pass(self, mocked_checked_binary_exists):
|
||||||
|
@ -217,7 +217,7 @@ class TestEasyWorshipSongImport(TestCase):
|
|||||||
for field_name in non_existing_fields:
|
for field_name in non_existing_fields:
|
||||||
|
|
||||||
# THEN: The importer object should not be None
|
# 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):
|
def test_set_record_struct(self):
|
||||||
"""
|
"""
|
||||||
|
@ -153,9 +153,8 @@ class TestOpenLyricsImport(TestCase, TestMixin):
|
|||||||
ol._process_formatting_tags(song_xml, False)
|
ol._process_formatting_tags(song_xml, False)
|
||||||
|
|
||||||
# THEN: New tags should have been saved
|
# THEN: New tags should have been saved
|
||||||
assertListEqual(json.loads(json.dumps(result_tags)),
|
assert json.loads(json.dumps(result_tags)) == json.loads(str(Settings().value('formattingTags/html_tags'))), \
|
||||||
json.loads(str(Settings().value('formattingTags/html_tags'))),
|
'The formatting tags should contain both the old and the new'
|
||||||
'The formatting tags should contain both the old and the new')
|
|
||||||
|
|
||||||
def test_process_author(self):
|
def test_process_author(self):
|
||||||
"""
|
"""
|
||||||
|
@ -45,8 +45,8 @@ class TestSongUsage(TestCase):
|
|||||||
# THEN: about() should return a string object
|
# THEN: about() should return a string object
|
||||||
assert isinstance(SongUsagePlugin.about(), str)
|
assert isinstance(SongUsagePlugin.about(), str)
|
||||||
# THEN: about() should return a non-empty string
|
# THEN: about() should return a non-empty string
|
||||||
assertNotEquals(len(SongUsagePlugin.about()), 0)
|
assert len(SongUsagePlugin.about()) is not 0
|
||||||
assertNotEquals(len(SongUsagePlugin.about()), 0)
|
assert len(SongUsagePlugin.about()) is not 0
|
||||||
|
|
||||||
@patch('openlp.plugins.songusage.songusageplugin.Manager')
|
@patch('openlp.plugins.songusage.songusageplugin.Manager')
|
||||||
def test_song_usage_init(self, MockedManager):
|
def test_song_usage_init(self, MockedManager):
|
||||||
|
@ -86,11 +86,11 @@ class TestPluginManager(TestCase, TestMixin):
|
|||||||
|
|
||||||
# THEN: We should find the "Songs", "Bibles", etc in the plugins list
|
# THEN: We should find the "Songs", "Bibles", etc in the plugins list
|
||||||
plugin_names = [plugin.name for plugin in plugin_manager.plugins]
|
plugin_names = [plugin.name for plugin in plugin_manager.plugins]
|
||||||
assertIn('songs', plugin_names, 'There should be a "songs" plugin')
|
assert 'songs' in plugin_names, 'There should be a "songs" plugin'
|
||||||
assertIn('bibles', plugin_names, 'There should be a "bibles" plugin')
|
assert 'bibles' in plugin_names, 'There should be a "bibles" plugin'
|
||||||
assertIn('presentations', plugin_names, 'There should be a "presentations" plugin')
|
assert 'presentations' in plugin_names, 'There should be a "presentations" plugin'
|
||||||
assertIn('images', plugin_names, 'There should be a "images" plugin')
|
assert 'images' in plugin_names, 'There should be a "images" plugin'
|
||||||
assertIn('media', plugin_names, 'There should be a "media" plugin')
|
assert 'media' in plugin_names, 'There should be a "media" plugin'
|
||||||
assertIn('custom', plugin_names, 'There should be a "custom" plugin')
|
assert 'custom' in plugin_names, 'There should be a "custom" plugin'
|
||||||
assertIn('songusage', plugin_names, 'There should be a "songusage" plugin')
|
assert 'songusage'in plugin_names, 'There should be a "songusage" plugin'
|
||||||
assertIn('alerts', plugin_names, 'There should be a "alerts" plugin')
|
assert 'alerts' in plugin_names, 'There should be a "alerts" plugin'
|
||||||
|
@ -470,7 +470,7 @@ class TestServiceManager(TestCase, TestMixin):
|
|||||||
selected_index = self.service_manager.service_manager_list.currentIndex()
|
selected_index = self.service_manager.service_manager_list.currentIndex()
|
||||||
assert self.service_manager.service_manager_list.isExpanded(selected_index) is False, \
|
assert self.service_manager.service_manager_list.isExpanded(selected_index) is False, \
|
||||||
'Item should have been collapsed'
|
'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'
|
'Top item should have been selected'
|
||||||
self.service_manager.collapsed.assert_called_once_with(song_item)
|
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()
|
selected_index = self.service_manager.service_manager_list.currentIndex()
|
||||||
assert self.service_manager.service_manager_list.isExpanded(selected_index) is False, \
|
assert self.service_manager.service_manager_list.isExpanded(selected_index) is False, \
|
||||||
'Item should have been collapsed'
|
'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'
|
'Top item should have been selected'
|
||||||
self.service_manager.collapsed.assert_called_once_with(song_item)
|
self.service_manager.collapsed.assert_called_once_with(song_item)
|
||||||
|
Loading…
Reference in New Issue
Block a user