From 94df2d2d86d3aebee8e609194c1552062912ad13 Mon Sep 17 00:00:00 2001 From: Ken Roberts Date: Sat, 9 Jan 2016 09:21:20 -0800 Subject: [PATCH] Fix test for pjlink ticket 921817 --- .../test_projector_utilities.py | 5 ---- .../openlp_core_lib/test_projector_pjlink1.py | 16 +++++++++---- tests/resources/projector/data.py | 23 +------------------ 3 files changed, 12 insertions(+), 32 deletions(-) diff --git a/tests/functional/openlp_core_common/test_projector_utilities.py b/tests/functional/openlp_core_common/test_projector_utilities.py index 7798da0d6..d29267de0 100644 --- a/tests/functional/openlp_core_common/test_projector_utilities.py +++ b/tests/functional/openlp_core_common/test_projector_utilities.py @@ -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 diff --git a/tests/functional/openlp_core_lib/test_projector_pjlink1.py b/tests/functional/openlp_core_lib/test_projector_pjlink1.py index e48130c29..ad11e93f6 100644 --- a/tests/functional/openlp_core_lib/test_projector_pjlink1.py +++ b/tests/functional/openlp_core_lib/test_projector_pjlink1.py @@ -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")) diff --git a/tests/resources/projector/data.py b/tests/resources/projector/data.py index 58e5f2df7..fca9c0ca0 100644 --- a/tests/resources/projector/data.py +++ b/tests/resources/projector/data.py @@ -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 +