diff --git a/ecrterm/packets/base_packets.py b/ecrterm/packets/base_packets.py index 773585a..02c23fb 100644 --- a/ecrterm/packets/base_packets.py +++ b/ecrterm/packets/base_packets.py @@ -531,3 +531,7 @@ class WriteFiles(WriteFileBase): return self._files[file_id][offset:(offset+length)] else: return self._files[file_id][offset:] + + @classmethod + def can_parse(cls, data: Union[bytes, List[int]]) -> bool: + return False diff --git a/ecrterm/tests/test_apdu.py b/ecrterm/tests/test_apdu.py index 38e1322..9f5f7e7 100644 --- a/ecrterm/tests/test_apdu.py +++ b/ecrterm/tests/test_apdu.py @@ -1,7 +1,7 @@ from ecrterm.packets.apdu import CommandAPDU, ParseError from ecrterm.packets.tlv import TLV from ecrterm.packets.fields import ByteField, BytesField, BCDIntField -from ecrterm.packets.base_packets import LogOff, Initialisation, Registration, DisplayText, Completion, PrintLine, Authorisation, WriteFile +from ecrterm.packets.base_packets import LogOff, Initialisation, Registration, DisplayText, Completion, PrintLine, Authorisation, WriteFileBase from unittest import TestCase, main @@ -175,12 +175,17 @@ class TestAPDUBitmaps(TestCase): class TestRegression(TestCase): def test_write_file_apdu(self): - c = WriteFile(password='000000', tlv=[ + c = WriteFileBase(password='000000', tlv=[ (0x2d, {0x1d: 0x20, 0x1f00: 615}), (0x2d, {0x1d: 0x21, 0x1f00: 3403228}), ]) c.serialize() + def test_write_file_2(self): + c = CommandAPDU.parse([16, 2, 8, 20, 101, 0, 0, 0, 6, 96, 45, 10, 29, 1, 48, 31, 0, 4, 0, 0, 2, 103, 45, 10, 29, 1, 49, 31, 0, 4, 0, 0, 0, 231, 45, 10, 29, 1, 33, 31, 0, 4, 0, 59, 48, 18, 45, 10, 29, 1, 32, 31, 0, 4, 0, 0, 2, 103, 45, 10, 29, 1, 16, 16, 31, 0, 4, 0, 41, 58, 67, 45, 10, 29, 1, 17, 31, 0, 4, 0, 180, 5, 108, 45, 10, 29, 1, 18, 31, 0, 4, 0, 0, 3, 57, 45, 10, 29, 1, 19, 31, 0, 4, 0, 0, 6, 2, 16, 3, 185, 57]) + self.assertIsInstance(c, WriteFileBase) + + if __name__ == '__main__': main()