def test_disconnect(client): """ MoIP Disconnect Test """ pytest.skip("Not support at this time") count = moip.get_devicecount(client) devices = count.rstrip().split(",") transmitters = int(devices[0]) receivers = int(devices[1]) if transmitters == 0: pytest.skip("No transmitters to switch") if receivers == 0: pytest.skip("No receivers to switch") for rx in range(receivers): api = "!Switch=" + "0" + "," + str(rx + 1) client.send(api + "\n") time.sleep(1) res = client.receive() # Example # # !Switch=0,1 if res.rstrip() == controlapi.ERROR: pytest.fail("Error returned from call " + api)
def test_switch(client): """ MoIP Switch Test """ count = moip.get_devicecount(client) devices = count.rstrip().split(",") transmitters = int(devices[0]) receivers = int(devices[1]) if transmitters == 0: pytest.skip("No transmitters to switch") if receivers == 0: pytest.skip("No receivers to switch") rx_to_switch = str(random.randint(1, receivers)) tx_to_switch = str(random.randint(1, transmitters)) api = "!Switch=" + tx_to_switch + "," + rx_to_switch client.send(api + "\n") time.sleep(1) res = client.receive() # Example # # !Switch=1,1 if res.rstrip() == controlapi.ERROR: pytest.fail("Error returned from call " + api)
def test_ir(client): """ MoIP IR Test """ count = moip.get_devicecount(client) devices = count.rstrip().split(",") transmitters = int(devices[0]) receivers = int(devices[1]) if transmitters == 0: pytest.skip("No transmitters to send ir code to") if receivers == 0: pytest.skip("No receivers to send ir code to") for rx in range(receivers): api = "!IR=0," + str(rx + 1) + "," + moip.IR_PRONTO_CODE client.send(api + "\n") time.sleep(1) res = client.receive() # Example # # !IR=0,1,0000 1111 2222 if res.rstrip() == controlapi.ERROR: pytest.fail("Error returned from call " + api) for tx in range(transmitters): api = "!IR=1," + str(tx + 1) + "," + moip.IR_PRONTO_CODE client.send(api + "\n") time.sleep(1) res = client.receive() # Example # # !IR=1,1,0000 1111 2222 if res.rstrip() == controlapi.ERROR: pytest.fail("Error returned from call " + api)
def test_resolution(client, resolution): """ MoIP Resolution Test """ count = moip.get_devicecount(client) devices = count.rstrip().split(",") receivers = int(devices[1]) if receivers == 0: pytest.skip("No receivers to change resolution on") for rx in range(receivers): api = "!Resolution=" + str(rx + 1) + "," + resolution client.send(api + "\n") time.sleep(1) res = client.receive() # Example # # !Resolution=1,1 if res.rstrip() == controlapi.ERROR: pytest.fail("Error returned from call " + api)
def test_cec(client, mode): """ MoIP CEC Test """ count = moip.get_devicecount(client) devices = count.rstrip().split(",") receivers = int(devices[1]) if receivers == 0: pytest.skip("No receivers to change osd on") for rx in range(receivers): api = "!CEC=" + str(rx + 1) + "," + mode client.send(api + "\n") time.sleep(1) res = client.receive() # Example # # !CEC=1,0 if res.rstrip() == controlapi.ERROR: pytest.fail("Error returned from call " + api)