mirror of
https://github.com/lowobservable/oec.git
synced 2026-04-16 00:21:02 +00:00
Add insert support to TN3270
This commit is contained in:
@@ -6,7 +6,7 @@ import context
|
||||
from oec.session import SessionDisconnectedError
|
||||
from oec.keyboard import Key, KeyboardModifiers
|
||||
from oec.tn3270 import TN3270Session
|
||||
from tn3270 import AttributeCell, CharacterCell, AID, ProtectedCellOperatorError
|
||||
from tn3270 import AttributeCell, CharacterCell, AID, ProtectedCellOperatorError, FieldOverflowOperatorError
|
||||
|
||||
class SessionHandleHostTestCase(unittest.TestCase):
|
||||
def setUp(self):
|
||||
@@ -188,7 +188,20 @@ class SessionHandleKeyTestCase(unittest.TestCase):
|
||||
self.session.handle_key(Key.LOWER_A, KeyboardModifiers.NONE, None)
|
||||
|
||||
# Assert
|
||||
self.session.emulator.input.assert_called_with(0x81)
|
||||
self.session.emulator.input.assert_called_with(0x81, False)
|
||||
|
||||
def test_insert(self):
|
||||
# Act
|
||||
self.session.handle_key(Key.INSERT, KeyboardModifiers.NONE, None)
|
||||
|
||||
self.session.handle_key(Key.LOWER_A, KeyboardModifiers.NONE, None)
|
||||
|
||||
self.session.handle_key(Key.INSERT, KeyboardModifiers.NONE, None)
|
||||
|
||||
# Assert
|
||||
self.assertFalse(self.session.keyboard_insert)
|
||||
|
||||
self.session.emulator.input.assert_called_with(0x81, True)
|
||||
|
||||
def test_protected_cell_operator_error(self):
|
||||
# Arrange
|
||||
@@ -200,6 +213,16 @@ class SessionHandleKeyTestCase(unittest.TestCase):
|
||||
# Assert
|
||||
self.terminal.display.status_line.write.assert_called_with(8, bytes.fromhex('f600f8dbd800000000'))
|
||||
|
||||
def test_field_overflow_operator_error(self):
|
||||
# Arrange
|
||||
self.session.emulator.input = Mock(side_effect=FieldOverflowOperatorError)
|
||||
|
||||
# Act
|
||||
self.session.handle_key(Key.LOWER_A, KeyboardModifiers.NONE, None)
|
||||
|
||||
# Assert
|
||||
self.terminal.display.status_line.write.assert_called_with(8, bytes.fromhex('f600db080000000000'))
|
||||
|
||||
class MockDisplay:
|
||||
def __init__(self, rows, columns):
|
||||
self.buffer = bytearray(rows * columns)
|
||||
|
||||
Reference in New Issue
Block a user