31 lines
786 B
Python
31 lines
786 B
Python
import pytest
|
|
from ecu_framework.flashing.hex_flasher import HexFlasher
|
|
from ecu_framework.lin.base import LinFrame
|
|
|
|
|
|
class _StubLin:
|
|
def __init__(self):
|
|
self.sent = []
|
|
def connect(self):
|
|
pass
|
|
def disconnect(self):
|
|
pass
|
|
def send(self, frame: LinFrame):
|
|
self.sent.append(frame)
|
|
def receive(self, id=None, timeout=1.0):
|
|
return None
|
|
|
|
|
|
@pytest.mark.unit
|
|
def test_hex_flasher_sends_basic_sequence(tmp_path):
|
|
# Minimal valid Intel HEX file (EOF record)
|
|
hex_path = tmp_path / "fw.hex"
|
|
hex_path.write_text(":00000001FF\n")
|
|
|
|
lin = _StubLin()
|
|
flasher = HexFlasher(lin)
|
|
flasher.flash_hex(str(hex_path))
|
|
|
|
# Placeholder assertion; refine as the flasher gains functionality
|
|
assert isinstance(lin.sent, list)
|