~tomasgroth/openlp/portable-path

« back to all changes in this revision

Viewing changes to tests/openlp_core/projectors/test_projector_pjlink_commands_02.py

  • Committer: Tomas Groth
  • Date: 2019-04-30 19:02:42 UTC
  • mfrom: (2829.2.32 openlp)
  • Revision ID: tomasgroth@yahoo.dk-20190430190242-6zwjk8724tyux70m
trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
###############################################################################
5
5
# OpenLP - Open Source Lyrics Projection                                      #
6
6
# --------------------------------------------------------------------------- #
7
 
# Copyright (c) 2008-2015 OpenLP Developers                                   #
 
7
# Copyright (c) 2008-2019 OpenLP Developers                                   #
8
8
# --------------------------------------------------------------------------- #
9
9
# This program is free software; you can redistribute it and/or modify it     #
10
10
# under the terms of the GNU General Public License as published by the Free  #
23
23
Package to test the openlp.core.projectors.pjlink commands package.
24
24
"""
25
25
from unittest import TestCase, skip
26
 
from unittest.mock import patch, call
 
26
from unittest.mock import call, patch
27
27
 
28
28
import openlp.core.projectors.pjlink
29
29
from openlp.core.projectors.constants import PJLINK_PORT, S_CONNECTED, S_OFF, S_ON
30
30
from openlp.core.projectors.db import Projector
31
31
from openlp.core.projectors.pjlink import PJLink, PJLinkUDP
32
 
from tests.resources.projector.data import TEST_HASH, TEST_PIN, TEST_SALT, TEST1_DATA, TEST2_DATA
 
32
from tests.resources.projector.data import TEST1_DATA, TEST2_DATA, TEST_HASH, TEST_PIN, TEST_SALT
33
33
 
34
34
 
35
35
class TestPJLinkCommands(TestCase):
36
36
    """
37
37
    Tests for the PJLinkCommands class part 2
38
38
    """
 
39
    @skip('Needs update to new setup')
39
40
    def test_projector_reset_information(self):
40
41
        """
41
42
        Test reset_information() resets all information and stops timers
83
84
                assert mock_socket_timer.stop.called is True, 'Projector socket_timer.stop() should have been called'
84
85
                mock_log.debug.assert_has_calls(log_debug_calls)
85
86
 
 
87
    @skip('Needs update to new setup')
86
88
    def test_process_pjlink_normal(self):
87
89
        """
88
90
        Test initial connection prompt with no authentication
108
110
        mock_change_status.assert_called_once_with(S_CONNECTED)
109
111
        mock_send_command.assert_called_with(cmd='CLSS', priority=True, salt=None)
110
112
 
 
113
    @skip('Needs update to new setup')
111
114
    def test_process_pjlink_authenticate(self):
112
115
        """
113
116
        Test initial connection prompt with authentication
133
136
        mock_change_status.assert_called_once_with(S_CONNECTED)
134
137
        mock_send_command.assert_called_with(cmd='CLSS', priority=True, salt=TEST_HASH)
135
138
 
 
139
    @skip('Needs update to new setup')
136
140
    def test_process_pjlink_normal_pin_set_error(self):
137
141
        """
138
142
        Test process_pjlinnk called with no authentication but pin is set
154
158
        assert 1 == mock_disconnect_from_host.call_count, 'Should have only been called once'
155
159
        mock_send_command.assert_not_called()
156
160
 
 
161
    @skip('Needs update to new setup')
157
162
    def test_process_pjlink_normal_with_salt_error(self):
158
163
        """
159
164
        Test process_pjlinnk called with no authentication but pin is set
175
180
        assert 1 == mock_disconnect_from_host.call_count, 'Should have only been called once'
176
181
        mock_send_command.assert_not_called()
177
182
 
 
183
    @skip('Needs update to new setup')
178
184
    def test_process_pjlink_invalid_authentication_scheme_length_error(self):
179
185
        """
180
186
        Test initial connection prompt with authentication scheme longer than 1 character
195
201
        assert 1 == mock_disconnect_from_host.call_count, 'Should have only been called once'
196
202
        mock_send_command.assert_not_called()
197
203
 
 
204
    @skip('Needs update to new setup')
198
205
    def test_process_pjlink_invalid_authentication_data_length_error(self):
199
206
        """
200
207
        Test initial connection prompt with authentication no salt
215
222
        assert 1 == mock_disconnect_from_host.call_count, 'Should have only been called once'
216
223
        mock_send_command.assert_not_called()
217
224
 
 
225
    @skip('Needs update to new setup')
218
226
    def test_process_pjlink_authenticate_pin_not_set_error(self):
219
227
        """
220
228
        Test process_pjlink authentication but pin not set