import pytest
from target_simulator.core.communicator_interface import CommunicatorInterface
from target_simulator.core.models import Scenario


class DummyCommunicator(CommunicatorInterface):
    def connect(self, config):
        return True

    def disconnect(self):
        return True

    @property
    def is_open(self):
        return True

    def send_scenario(self, scenario):
        return True

    @staticmethod
    def test_connection(config):
        return True

    @staticmethod
    def list_available_ports():
        return ["COM1", "COM2"]


def test_dummy_communicator_methods():
    comm = DummyCommunicator()
    assert comm.connect({}) is True
    assert comm.is_open is True
    assert comm.send_scenario(Scenario()) is True
    assert DummyCommunicator.test_connection({}) is True
    assert isinstance(DummyCommunicator.list_available_ports(), list)
    comm.disconnect()
