예제 #1
0
    def test(self):
        # Arrange
        telnet = Telnet('IBM-3278-2')

        telnet.socket = Mock()

        # Act
        telnet.write(bytes.fromhex('01 02 03 ff 04 05'))

        # Assert
        telnet.socket.sendall.assert_called_with(
            bytes.fromhex('01 02 03 ff ff 04 05 ff ef'))
예제 #2
0
    def test_tn3270e(self):
        # Arrange
        telnet = Telnet('IBM-3279-2-E')

        telnet.socket = create_autospec(socket, instance=True)

        telnet.is_tn3270e_negotiated = True

        # Act
        telnet.write(bytes.fromhex('01 02 03 ff 04 05'))

        # Assert
        telnet.socket.sendall.assert_called_with(
            bytes.fromhex('00 00 00 00 00 01 02 03 ff ff 04 05 ff ef'))
예제 #3
0
    def test_basic_tn3270(self):
        # Arrange
        telnet = Telnet('IBM-3279-2-E')

        telnet.socket = Mock()

        telnet.is_tn3270e_negotiated = False

        # Act
        telnet.write(bytes.fromhex('01 02 03 ff 04 05'))

        # Assert
        telnet.socket.sendall.assert_called_with(
            bytes.fromhex('01 02 03 ff ff 04 05 ff ef'))