diff --git a/tests/functional/openlp_core_common/test_registryproperties.py b/tests/functional/openlp_core_common/test_registryproperties.py index 98408b323..45eb4d45e 100644 --- a/tests/functional/openlp_core_common/test_registryproperties.py +++ b/tests/functional/openlp_core_common/test_registryproperties.py @@ -75,4 +75,3 @@ class TestRegistryProperties(TestCase, RegistryProperties): # THEN the application should be none self.assertEqual(self.application, application, 'The application value should match') - diff --git a/tests/functional/openlp_core_lib/test_projector_pjlink1.py b/tests/functional/openlp_core_lib/test_projector_pjlink1.py index 4928e5d0c..01ddde060 100644 --- a/tests/functional/openlp_core_lib/test_projector_pjlink1.py +++ b/tests/functional/openlp_core_lib/test_projector_pjlink1.py @@ -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: diff --git a/tests/functional/openlp_core_lib/test_projectordb.py b/tests/functional/openlp_core_lib/test_projectordb.py index 61263042f..0b780acd2 100644 --- a/tests/functional/openlp_core_lib/test_projectordb.py +++ b/tests/functional/openlp_core_lib/test_projectordb.py @@ -284,3 +284,16 @@ class TestProjectorDB(TestCase): self.assertEqual(str(source), '', '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') diff --git a/tests/functional/openlp_plugins/bibles/test_lib.py b/tests/functional/openlp_plugins/bibles/test_lib.py index a8dba0bd9..27d7f5e51 100644 --- a/tests/functional/openlp_plugins/bibles/test_lib.py +++ b/tests/functional/openlp_plugins/bibles/test_lib.py @@ -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 diff --git a/tests/functional/openlp_plugins/songs/test_opsproimport.py b/tests/functional/openlp_plugins/songs/test_opsproimport.py index 239b77c30..8db69b609 100644 --- a/tests/functional/openlp_plugins/songs/test_opsproimport.py +++ b/tests/functional/openlp_plugins/songs/test_opsproimport.py @@ -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')) -