Files
pm3py/tests/test_hf_14a.py
michael 42e6b54f29 refactor: move modules into core/ sub-package, normalize naming
Phase 1 of package refactor. Moves all source modules into pm3py/core/
with file renames (hf_14a→hf_iso14a, hf_15→hf_iso15, hf_mf→hf_mfc)
and client attribute normalization (hf.a14→hf.iso14a, hf.mf→hf.mfc).
pm3py/__init__.py re-exports from core for backward compat.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 19:24:05 -07:00

26 lines
889 B
Python

import struct
import asyncio
from unittest.mock import AsyncMock
from pm3py.core.protocol import Cmd
from pm3py.core.transport import PM3Response
from pm3py.core.hf_iso14a import HF14ACommands
def test_14a_scan():
t = AsyncMock()
hf14a = HF14ACommands(t)
# Build iso14a_card_select_t response
uid = b"\x04\x01\x02\x03\x04\x05\x06"
card = uid + b"\x00" * 3 # uid[10]
card += bytes([7]) # uidlen
card += b"\x44\x00" # atqa
card += bytes([0x08]) # sak
card += bytes([0]) # ats_len
card += b"\x00" * 256 # ats
resp = PM3Response(cmd=Cmd.ACK, status=0, reason=0, ng=False,
data=card, oldarg=[1, 0, 0])
t.send_mix.return_value = resp
result = asyncio.get_event_loop().run_until_complete(hf14a.scan())
assert result["uid"] == "04010203040506"
assert result["uid_len"] == 7
assert result["sak"] == 0x08