forked from openlp/openlp
Move helper classes from resources to helpers
This commit is contained in:
parent
801e593131
commit
f15b46ebaf
@ -30,7 +30,33 @@ from openlp.core.projectors.db import Projector
|
|||||||
from tests.resources.projector.data import TEST1_DATA
|
from tests.resources.projector.data import TEST1_DATA
|
||||||
|
|
||||||
|
|
||||||
|
class FakeProjector(object):
|
||||||
|
"""
|
||||||
|
Helper test class
|
||||||
|
"""
|
||||||
|
def __init__(self, port=4352, name="Faker"):
|
||||||
|
self.link = self
|
||||||
|
self.entry = self
|
||||||
|
self.name = name
|
||||||
|
self.pin = None
|
||||||
|
self.port = port
|
||||||
|
|
||||||
|
|
||||||
|
class FakePJLinkUDP(object):
|
||||||
|
"""
|
||||||
|
Helper test class
|
||||||
|
"""
|
||||||
|
def __init__(self, *args, **kwargs):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def check_settings(self, *args, **kwargs):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
class FakePJLink(object):
|
class FakePJLink(object):
|
||||||
|
"""
|
||||||
|
Helper class with signals and methods mocked
|
||||||
|
"""
|
||||||
def __init__(self, projector=None, *args, **kwargs):
|
def __init__(self, projector=None, *args, **kwargs):
|
||||||
# Signal mocks
|
# Signal mocks
|
||||||
self.projectorStatus = MagicMock()
|
self.projectorStatus = MagicMock()
|
||||||
|
@ -30,22 +30,12 @@ from openlp.core.projectors.pjlinkcommands import process_pjlink
|
|||||||
from openlp.core.projectors.constants import E_AUTHENTICATION, E_NO_AUTHENTICATION, \
|
from openlp.core.projectors.constants import E_AUTHENTICATION, E_NO_AUTHENTICATION, \
|
||||||
S_AUTHENTICATE, S_CONNECT
|
S_AUTHENTICATE, S_CONNECT
|
||||||
|
|
||||||
|
from tests.helpers.projector import FakeProjector
|
||||||
from tests.resources.projector.data import TEST_PIN, TEST_SALT
|
from tests.resources.projector.data import TEST_PIN, TEST_SALT
|
||||||
|
|
||||||
test_module = openlp.core.projectors.pjlinkcommands.__name__
|
test_module = openlp.core.projectors.pjlinkcommands.__name__
|
||||||
|
|
||||||
|
|
||||||
class FakeProjector(object):
|
|
||||||
"""
|
|
||||||
Helper test class
|
|
||||||
"""
|
|
||||||
def __init__(self, port=4352, name="Faker"):
|
|
||||||
self.entry = self
|
|
||||||
self.name = name
|
|
||||||
self.pin = None
|
|
||||||
self.port = port
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def fake_pjlink():
|
def fake_pjlink():
|
||||||
"""
|
"""
|
||||||
|
@ -26,7 +26,7 @@ import logging
|
|||||||
from unittest.mock import MagicMock, patch
|
from unittest.mock import MagicMock, patch
|
||||||
|
|
||||||
|
|
||||||
from tests.resources.projector.data import FakePJLinkUDP, FakeProjector
|
from tests.helpers.projector import FakePJLinkUDP, FakeProjector
|
||||||
|
|
||||||
|
|
||||||
def test_udp_listen_add_duplicate(projector_manager, caplog):
|
def test_udp_listen_add_duplicate(projector_manager, caplog):
|
||||||
|
@ -286,24 +286,3 @@ TEST_VIDEO_CODES = {
|
|||||||
'6Y': 'Internal Y',
|
'6Y': 'Internal Y',
|
||||||
'6Z': 'Internal Z'
|
'6Z': 'Internal Z'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class FakeProjector(object):
|
|
||||||
"""
|
|
||||||
Helper test class
|
|
||||||
"""
|
|
||||||
def __init__(self, port=4352, name="Faker"):
|
|
||||||
self.link = self
|
|
||||||
self.port = port
|
|
||||||
self.name = name
|
|
||||||
|
|
||||||
|
|
||||||
class FakePJLinkUDP(object):
|
|
||||||
"""
|
|
||||||
Helper test class
|
|
||||||
"""
|
|
||||||
def __init__(self, *args, **kwargs):
|
|
||||||
pass
|
|
||||||
|
|
||||||
def check_settings(self, *args, **kwargs):
|
|
||||||
pass
|
|
||||||
|
Loading…
Reference in New Issue
Block a user