forked from openlp/openlp
Tests fixes and updates
This commit is contained in:
parent
598d715de6
commit
ed7ea01f43
@ -75,4 +75,3 @@ class TestRegistryProperties(TestCase, RegistryProperties):
|
||||
|
||||
# THEN the application should be none
|
||||
self.assertEqual(self.application, application, 'The application value should match')
|
||||
|
||||
|
@ -29,26 +29,12 @@ from openlp.core.lib.projector.pjlink1 import PJLink1
|
||||
from openlp.core.lib.projector.constants import E_PARAMETER, ERROR_STRING, S_OFF, S_STANDBY, S_WARMUP, S_ON, \
|
||||
S_COOLDOWN, PJLINK_POWR_STATUS
|
||||
|
||||
from tests.functional import patch
|
||||
from tests.functional import MagicMock, patch
|
||||
from tests.resources.projector.data import TEST_PIN, TEST_SALT, TEST_CONNECT_AUTHENTICATE
|
||||
|
||||
pjlink_test = PJLink1(name='test', ip='127.0.0.1', pin=TEST_PIN, no_poll=True)
|
||||
|
||||
|
||||
class DummyTimer(object):
|
||||
'''
|
||||
Dummy class to fake timers
|
||||
'''
|
||||
def __init__(self, *args, **kwargs):
|
||||
pass
|
||||
|
||||
def start(self, *args, **kwargs):
|
||||
pass
|
||||
|
||||
def stop(self, *args, **kwargs):
|
||||
pass
|
||||
|
||||
|
||||
class TestPJLink(TestCase):
|
||||
"""
|
||||
Tests for the PJLink module
|
||||
@ -308,8 +294,8 @@ class TestPJLink(TestCase):
|
||||
pjlink.other_info = 'ANOTHER TEST'
|
||||
pjlink.send_queue = True
|
||||
pjlink.send_busy = True
|
||||
pjlink.timer = DummyTimer()
|
||||
pjlink.socket_timer = DummyTimer()
|
||||
pjlink.timer = MagicMock()
|
||||
pjlink.socket_timer = MagicMock()
|
||||
|
||||
# WHEN: reset_information() is called
|
||||
with patch.object(pjlink.timer, 'stop') as mock_timer:
|
||||
|
@ -284,3 +284,16 @@ class TestProjectorDB(TestCase):
|
||||
self.assertEqual(str(source),
|
||||
'<ProjectorSource(id="1", code="11", text="First RGB source", projector_id="1")>',
|
||||
'ProjectorSource.__repr__)_ should have returned a proper representation string')
|
||||
|
||||
def test_get_projector_by_id_none(self):
|
||||
"""
|
||||
Test get_projector_by_id returns None if no db entry
|
||||
"""
|
||||
# GIVEN: Test object and data
|
||||
projector = self.projector
|
||||
|
||||
# WHEN: DB search for entry not saved
|
||||
results = projector.get_projector_by_id(dbid=123134556409824506)
|
||||
|
||||
# THEN: Verify return was None
|
||||
self.assertEqual(results, None, 'Returned results should have equaled None')
|
||||
|
@ -43,6 +43,7 @@ class TestLib(TestCase):
|
||||
separators = {'sep_r': '\\s*(?:e)\\s*', 'sep_e_default': 'end', 'sep_v_display': 'w', 'sep_l_display': 'r',
|
||||
'sep_v_default': ':|v|V|verse|verses', 'sep_l': '\\s*(?:r)\\s*', 'sep_l_default': ',|and',
|
||||
'sep_e': '\\s*(?:t)\\s*', 'sep_v': '\\s*(?:w)\\s*', 'sep_r_display': 'e', 'sep_r_default': '-|to'}
|
||||
|
||||
def _update_side_effect():
|
||||
"""
|
||||
Update the references after mocking out the method
|
||||
|
@ -171,4 +171,3 @@ class TestOpsProSongImport(TestCase):
|
||||
result_data = json.loads(result_file.read().decode())
|
||||
self.assertListEqual(importer.verses, _get_item(result_data, 'verses'))
|
||||
self.assertListEqual(importer.verse_order_list_generated, _get_item(result_data, 'verse_order_list'))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user