import pytest

from matterlab_relays import JYdaqRelay


@pytest.mark.real
def test_jydaq_real_read(hardware_com_port, hardware_address, hardware_channel):
    relay = JYdaqRelay(com_port=hardware_com_port, address=hardware_address, channel=hardware_channel)
    relay._add_rtu_master()

    assert isinstance(relay.on, bool)


@pytest.mark.real
def test_jydaq_real_toggle(hardware_com_port, hardware_address, hardware_channel):
    relay = JYdaqRelay(com_port=hardware_com_port, address=hardware_address, channel=hardware_channel)
    relay._add_rtu_master()

    relay.on = True
    relay.on = False
