import os
import sys

here = os.path.dirname(__file__)
sys.path.insert(0, os.path.abspath(os.path.join(here, "..", "src")))


class FakeTransport:
    def __init__(self):
        self.sent = []
        self.on_recv = None

    def send(self, data: bytes):
        self.sent.append(data)

    def start_recv(self):
        pass

    def stop_recv(self):
        pass


def test_codec_build_parse_roundtrip():
    from py_mavlink_dji import codec
    data = codec.build_command("TAKEOFF", b"")
    name, payload = codec.parse_frame(data)
    assert name == "TAKEOFF"
    assert payload == b""


