forked from openlp/openlp
Fix test for pjlink ticket 921817
This commit is contained in:
parent
8fcae33516
commit
94df2d2d86
@ -30,11 +30,6 @@ from unittest import TestCase
|
||||
from openlp.core.common import verify_ip_address, md5_hash, qmd5_hash
|
||||
|
||||
from tests.resources.projector.data import TEST_PIN, TEST_SALT, TEST_HASH
|
||||
'''
|
||||
salt = '498e4a67'
|
||||
pin = 'JBMIAProjectorLink'
|
||||
test_hash = '5d8409bc1c3fa39749434aa3a5c38682'
|
||||
'''
|
||||
salt = TEST_SALT
|
||||
pin = TEST_PIN
|
||||
test_hash = TEST_HASH
|
||||
|
@ -31,16 +31,16 @@ from openlp.core.lib.projector.pjlink1 import PJLink1
|
||||
|
||||
from tests.resources.projector.data import TEST_PIN, TEST_SALT, TEST_CONNECT_AUTHENTICATE
|
||||
|
||||
pjlink = PJLink1(name='test', ip='127.0.0.1', pin=TEST_PIN, no_poll=True)
|
||||
pjlink_test = PJLink1(name='test', ip='127.0.0.1', pin=TEST_PIN, no_poll=True)
|
||||
|
||||
|
||||
class TestPJLink(TestCase):
|
||||
"""
|
||||
Tests for the PJLink module
|
||||
"""
|
||||
@patch.object(pjlink, 'readyRead')
|
||||
@patch.object(pjlink, 'send_command')
|
||||
@patch.object(pjlink, 'waitForReadyRead')
|
||||
@patch.object(pjlink_test, 'readyRead')
|
||||
@patch.object(pjlink_test, 'send_command')
|
||||
@patch.object(pjlink_test, 'waitForReadyRead')
|
||||
@patch('openlp.core.common.qmd5_hash')
|
||||
def ticket_92187_test(self,
|
||||
mock_qmd5_hash,
|
||||
@ -50,8 +50,14 @@ class TestPJLink(TestCase):
|
||||
"""
|
||||
Fix for projector connect with PJLink authentication exception
|
||||
"""
|
||||
# GIVEN: Test object
|
||||
pjlink = pjlink_test
|
||||
|
||||
# WHEN: Calling check_login with authentication request:
|
||||
pjlink.check_login(data=TEST_CONNECT_AUTHENTICATE)
|
||||
|
||||
# THEN: Should have called qmd5_hash
|
||||
mock_qmd5_hash.called_with(TEST_SALT, TEST_PIN)
|
||||
self.assertTrue(mock_qmd5_hash.called_with(TEST_SALT,
|
||||
"Connection request should have been called with TEST_SALT"))
|
||||
self.assertTrue(mock_qmd5_hash.called_with(TEST_PIN,
|
||||
"Connection request should have been called with TEST_PIN"))
|
||||
|
@ -37,27 +37,6 @@ TEST_HASH = '5d8409bc1c3fa39749434aa3a5c38682'
|
||||
|
||||
TEST_CONNECT_AUTHENTICATE = 'PJLink 1 {salt}'.format(salt=TEST_SALT)
|
||||
|
||||
TEST1_DATA = Projector(ip='111.111.111.111',
|
||||
port='1111',
|
||||
pin='1111',
|
||||
name='___TEST_ONE___',
|
||||
location='location one',
|
||||
notes='notes one')
|
||||
|
||||
TEST2_DATA = Projector(ip='222.222.222.222',
|
||||
port='2222',
|
||||
pin='2222',
|
||||
name='___TEST_TWO___',
|
||||
location='location two',
|
||||
notes='notes two')
|
||||
|
||||
TEST3_DATA = Projector(ip='333.333.333.333',
|
||||
port='3333',
|
||||
pin='3333',
|
||||
name='___TEST_THREE___',
|
||||
location='location three',
|
||||
notes='notes three')
|
||||
|
||||
TEST_DB = os.path.join(gettempdir(), 'openlp-test-projectordb.sql')
|
||||
|
||||
TEST1_DATA = dict(ip='111.111.111.111',
|
||||
@ -80,4 +59,4 @@ TEST3_DATA = dict(ip='333.333.333.333',
|
||||
name='___TEST_THREE___',
|
||||
location='location three',
|
||||
notes='notes three')
|
||||
>>>>>>> MERGE-SOURCE
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user