feat(pm3py): ISO15693 + MIFARE Classic commands
This commit is contained in:
26
tests/test_hf_mf.py
Normal file
26
tests/test_hf_mf.py
Normal file
@@ -0,0 +1,26 @@
|
||||
import struct
|
||||
import asyncio
|
||||
from unittest.mock import AsyncMock
|
||||
from pm3py.protocol import Cmd
|
||||
from pm3py.transport import PM3Response
|
||||
from pm3py.hf_mf import HFMFCommands
|
||||
|
||||
def test_mf_rdbl():
|
||||
t = AsyncMock()
|
||||
mf = HFMFCommands(t)
|
||||
block_data = bytes(range(16))
|
||||
t.send_ng.return_value = PM3Response(cmd=Cmd.HF_MIFARE_READBL, status=0,
|
||||
reason=0, ng=True, data=block_data)
|
||||
result = asyncio.get_event_loop().run_until_complete(
|
||||
mf.rdbl(block=0, key="FFFFFFFFFFFF"))
|
||||
assert result["data"] == block_data.hex()
|
||||
assert len(result["raw"]) == 16
|
||||
|
||||
def test_mf_wrbl():
|
||||
t = AsyncMock()
|
||||
mf = HFMFCommands(t)
|
||||
t.send_mix.return_value = PM3Response(cmd=Cmd.ACK, status=0, reason=0,
|
||||
ng=False, data=b"", oldarg=[1, 0, 0])
|
||||
result = asyncio.get_event_loop().run_until_complete(
|
||||
mf.wrbl(block=4, key="FFFFFFFFFFFF", data="00" * 16))
|
||||
assert result["success"] is True
|
||||
Reference in New Issue
Block a user