forked from openlp/openlp
Fix tests and make pytest run clean
This commit is contained in:
parent
bb25804165
commit
ed3d92d818
@ -96,11 +96,11 @@ class TestSystemPlayer(TestCase):
|
||||
|
||||
# THEN: The player should have a display widget
|
||||
MockQVideoWidget.assert_called_once_with(mocked_display)
|
||||
assert mocked_video_widget, mocked_display.video_widget is True
|
||||
assert mocked_video_widget == mocked_display.video_widget
|
||||
mocked_display.size.assert_called_once_with()
|
||||
mocked_video_widget.resize.assert_called_once_with([1, 2, 3, 4])
|
||||
MockQMediaPlayer.assert_called_with(mocked_display)
|
||||
assert mocked_media_player, mocked_display.media_player is True
|
||||
assert mocked_media_player == mocked_display.media_player
|
||||
mocked_media_player.setVideoOutput.assert_called_once_with(mocked_video_widget)
|
||||
mocked_video_widget.raise_.assert_called_once_with()
|
||||
mocked_video_widget.hide.assert_called_once_with()
|
||||
|
@ -94,7 +94,7 @@ class TestVLCPlayer(TestCase, TestMixin):
|
||||
get_vlc()
|
||||
|
||||
# THEN: The extra environment variable should NOT be there
|
||||
assert 'VLC_PLUGIN_PATH'not in os.environ, 'The plugin path should NOT be in the environment variables'
|
||||
assert 'VLC_PLUGIN_PATH' not in os.environ, 'The plugin path should NOT be in the environment variables'
|
||||
|
||||
def test_init(self):
|
||||
"""
|
||||
@ -951,7 +951,7 @@ class TestVLCPlayer(TestCase, TestMixin):
|
||||
|
||||
# THEN: Certain methods should be called
|
||||
mocked_stop.assert_called_with(mocked_display)
|
||||
assert 2, mocked_stop.call_count
|
||||
assert 2 == mocked_stop.call_count
|
||||
mocked_display.vlc_media_player.get_time.assert_called_with()
|
||||
mocked_set_visible.assert_called_with(mocked_display, False)
|
||||
mocked_controller.seek_slider.setSliderPosition.assert_called_with(400000)
|
||||
@ -985,7 +985,7 @@ class TestVLCPlayer(TestCase, TestMixin):
|
||||
|
||||
# THEN: Certain methods should be called
|
||||
mocked_stop.assert_called_with(mocked_display)
|
||||
assert 2, mocked_stop.call_count
|
||||
assert 2 == mocked_stop.call_count
|
||||
mocked_display.vlc_media_player.get_time.assert_called_with()
|
||||
mocked_set_visible.assert_called_with(mocked_display, False)
|
||||
mocked_controller.seek_slider.setSliderPosition.assert_called_with(300)
|
||||
|
@ -29,8 +29,8 @@ from PyQt5 import QtCore, QtGui
|
||||
|
||||
from openlp.core.common.registry import Registry
|
||||
from openlp.core.lib import ServiceItemAction
|
||||
from openlp.core.ui.slidecontroller import SlideController, LiveController, PreviewController
|
||||
from openlp.core.ui.slidecontroller import InfoLabel, WIDE_MENU, NON_TEXT_MENU
|
||||
from openlp.core.ui.slidecontroller import InfoLabel, SlideController, LiveController, PreviewController, \
|
||||
NON_TEXT_MENU, WIDE_MENU
|
||||
|
||||
|
||||
class TestSlideController(TestCase):
|
||||
|
@ -108,7 +108,7 @@ class EasyWorshipSongImportLogger(EasyWorshipSongImport):
|
||||
self._title_assignment_list.append(title)
|
||||
|
||||
|
||||
class TestFieldDesc:
|
||||
class DataTestFieldDesc:
|
||||
def __init__(self, name, field_type, size):
|
||||
self.name = name
|
||||
self.field_type = field_type
|
||||
@ -120,11 +120,11 @@ CODE_PAGE_MAPPINGS = [
|
||||
(852, 'cp1250'), (737, 'cp1253'), (775, 'cp1257'), (855, 'cp1251'), (857, 'cp1254'),
|
||||
(866, 'cp1251'), (869, 'cp1253'), (862, 'cp1255'), (874, 'cp874')]
|
||||
TEST_FIELD_DESCS = [
|
||||
TestFieldDesc('Title', FieldType.String, 50),
|
||||
TestFieldDesc('Text Percentage Bottom', FieldType.Int16, 2), TestFieldDesc('RecID', FieldType.Int32, 4),
|
||||
TestFieldDesc('Default Background', FieldType.Logical, 1), TestFieldDesc('Words', FieldType.Memo, 250),
|
||||
TestFieldDesc('Words', FieldType.Memo, 250), TestFieldDesc('BK Bitmap', FieldType.Blob, 10),
|
||||
TestFieldDesc('Last Modified', FieldType.Timestamp, 10)]
|
||||
DataTestFieldDesc('Title', FieldType.String, 50),
|
||||
DataTestFieldDesc('Text Percentage Bottom', FieldType.Int16, 2), DataTestFieldDesc('RecID', FieldType.Int32, 4),
|
||||
DataTestFieldDesc('Default Background', FieldType.Logical, 1), DataTestFieldDesc('Words', FieldType.Memo, 250),
|
||||
DataTestFieldDesc('Words', FieldType.Memo, 250), DataTestFieldDesc('BK Bitmap', FieldType.Blob, 10),
|
||||
DataTestFieldDesc('Last Modified', FieldType.Timestamp, 10)]
|
||||
TEST_FIELDS = [
|
||||
b'A Heart Like Thine\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0', 32868, 2147483750,
|
||||
129, b'{\\rtf1\\ansi\\deff0\\deftab254{\\fonttbl{\\f0\\fnil\\fcharset0 Arial;}{\\f1\\fnil\\fcharset0 Verdana;}}'
|
||||
|
@ -34,7 +34,7 @@ except ImportError:
|
||||
CAN_RUN_TESTS = False
|
||||
|
||||
|
||||
class TestRecord(object):
|
||||
class DBTestRecord(object):
|
||||
"""
|
||||
Microsoft Access Driver is not available on non Microsoft Systems for this reason the :class:`TestRecord` is used
|
||||
to simulate a recordset that would be returned by pyobdc.
|
||||
@ -66,12 +66,12 @@ if CAN_RUN_TESTS:
|
||||
self._title_assignment_list.append(title)
|
||||
|
||||
|
||||
RECORDSET_TEST_DATA = [TestRecord(1, 'TITLE', 'Amazing Grace'),
|
||||
TestRecord(1, 'AUTHOR', 'John Newton'),
|
||||
TestRecord(1, 'CCLISONGID', '12345'),
|
||||
TestRecord(1, 'COMMENTS', 'The original version'),
|
||||
TestRecord(1, 'COPY', 'Public Domain'),
|
||||
TestRecord(
|
||||
RECORDSET_TEST_DATA = [DBTestRecord(1, 'TITLE', 'Amazing Grace'),
|
||||
DBTestRecord(1, 'AUTHOR', 'John Newton'),
|
||||
DBTestRecord(1, 'CCLISONGID', '12345'),
|
||||
DBTestRecord(1, 'COMMENTS', 'The original version'),
|
||||
DBTestRecord(1, 'COPY', 'Public Domain'),
|
||||
DBTestRecord(
|
||||
1, 'LYRICS',
|
||||
'Amazing grace! How&crlf;sweet the sound&crlf;That saved a wretch like me!&crlf;'
|
||||
'I once was lost,&crlf;but now am found;&crlf;Was blind, but now I see.&crlf;&crlf;'
|
||||
@ -88,8 +88,8 @@ RECORDSET_TEST_DATA = [TestRecord(1, 'TITLE', 'Amazing Grace'),
|
||||
'Shall be forever mine.&crlf;&crlf;When we\'ve been there&crlf;ten thousand years,&crlf;'
|
||||
'Bright shining as the sun,&crlf;We\'ve no less days to&crlf;sing God\'s praise&crlf;'
|
||||
'Than when we\'d first begun.&crlf;&crlf;'),
|
||||
TestRecord(2, 'TITLE', 'Beautiful Garden Of Prayer, The'),
|
||||
TestRecord(
|
||||
DBTestRecord(2, 'TITLE', 'Beautiful Garden Of Prayer, The'),
|
||||
DBTestRecord(
|
||||
2, 'LYRICS',
|
||||
'There\'s a garden where&crlf;Jesus is waiting,&crlf;'
|
||||
'There\'s a place that&crlf;is wondrously fair,&crlf;For it glows with the&crlf;'
|
||||
|
Loading…
Reference in New Issue
Block a user