mirror of
https://github.com/onyx-and-iris/xair-api-python.git
synced 2024-11-15 17:40:57 +00:00
add tests.x32 module
This commit is contained in:
parent
079d1b308d
commit
e4dc4d0b13
41
tests/x32/__init__.py
Normal file
41
tests/x32/__init__.py
Normal file
@ -0,0 +1,41 @@
|
||||
import sys
|
||||
import threading
|
||||
from dataclasses import dataclass
|
||||
|
||||
import xair_api
|
||||
from xair_api import kinds
|
||||
|
||||
kind_id = "X32"
|
||||
ip = "x32.local"
|
||||
|
||||
tests = xair_api.connect(kind_id, ip=ip)
|
||||
|
||||
kind = kinds.get(kind_id)
|
||||
|
||||
|
||||
@dataclass
|
||||
class Data:
|
||||
"""bounds data to map tests to a kind"""
|
||||
|
||||
name: str = kind.id_
|
||||
dca: int = kind.num_dca - 1
|
||||
strip: int = kind.num_strip - 1
|
||||
bus: int = kind.num_bus - 1
|
||||
fx: int = kind.num_fx - 1
|
||||
auxrtn: int = kind.num_auxrtn - 1
|
||||
matrix: int = kind.num_matrix - 1
|
||||
|
||||
|
||||
data = Data()
|
||||
|
||||
|
||||
def setup_module():
|
||||
print(f"\nRunning tests for kind [{data.name}]\n", file=sys.stdout)
|
||||
tests.worker = threading.Thread(target=tests.run_server)
|
||||
tests.worker.daemon = True
|
||||
tests.worker.start()
|
||||
tests.validate_connection()
|
||||
|
||||
|
||||
def teardown_module():
|
||||
tests.server.shutdown()
|
107
tests/x32/test_adapter.py
Normal file
107
tests/x32/test_adapter.py
Normal file
@ -0,0 +1,107 @@
|
||||
import pytest
|
||||
|
||||
from tests.x32 import data, tests
|
||||
|
||||
""" STRIP TESTS """
|
||||
|
||||
|
||||
class TestSetAndGetStripMixHigher:
|
||||
"""Mix"""
|
||||
|
||||
__test__ = True
|
||||
|
||||
def setup_class(self):
|
||||
self.target = getattr(tests, "strip")
|
||||
self.target = getattr(self.target[data.strip], "mix")
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"param,value",
|
||||
[("on", True), ("on", False)],
|
||||
)
|
||||
def test_it_sets_and_gets_strip_bool_params(self, param, value):
|
||||
setattr(self.target, param, value)
|
||||
assert getattr(self.target, param) == value
|
||||
|
||||
|
||||
""" BUS TESTS """
|
||||
|
||||
|
||||
class TestSetAndGetBusConfigHigher:
|
||||
"""Config"""
|
||||
|
||||
__test__ = True
|
||||
|
||||
def setup_class(self):
|
||||
self.target = getattr(tests, "bus")
|
||||
self.target = getattr(self.target[data.bus], "config")
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"param,value",
|
||||
[("color", 0), ("color", 15)],
|
||||
)
|
||||
def test_it_sets_and_gets_bus_int_params(self, param, value):
|
||||
setattr(self.target, param, value)
|
||||
assert getattr(self.target, param) == value
|
||||
|
||||
|
||||
""" AUXIN TESTS """
|
||||
|
||||
|
||||
class TestSetAndGetAuxInConfigHigher:
|
||||
"""Config"""
|
||||
|
||||
__test__ = True
|
||||
|
||||
def setup_class(self):
|
||||
self.target = getattr(tests, "auxin")
|
||||
self.target = getattr(self.target[data.auxrtn], "config")
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"param,value",
|
||||
[("name", "test0"), ("name", "test1")],
|
||||
)
|
||||
def test_it_sets_and_gets_auxrtn_string_params(self, param, value):
|
||||
setattr(self.target, param, value)
|
||||
assert getattr(self.target, param) == value
|
||||
|
||||
|
||||
""" FX RETURN TESTS """
|
||||
|
||||
|
||||
class TestSetAndGetFXReturnConfigHigher:
|
||||
"""Config"""
|
||||
|
||||
__test__ = True
|
||||
|
||||
def setup_class(self):
|
||||
self.target = getattr(tests, "fxreturn")
|
||||
self.target = getattr(self.target[data.fx], "config")
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"param,value",
|
||||
[("name", "test0"), ("name", "test1")],
|
||||
)
|
||||
def test_it_sets_and_gets_fxrtn_string_params(self, param, value):
|
||||
setattr(self.target, param, value)
|
||||
assert getattr(self.target, param) == value
|
||||
|
||||
|
||||
""" MATRIX TESTS """
|
||||
|
||||
|
||||
class TestSetAndGetMatrixConfigHigher:
|
||||
"""Config"""
|
||||
|
||||
__test__ = True
|
||||
|
||||
def setup_class(self):
|
||||
self.target = getattr(tests, "matrix")
|
||||
self.target = getattr(self.target[data.matrix], "config")
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"param,value",
|
||||
[("name", "test0"), ("name", "test1")],
|
||||
)
|
||||
def test_it_sets_and_gets_matrix_string_params(self, param, value):
|
||||
setattr(self.target, param, value)
|
||||
assert getattr(self.target, param) == value
|
Loading…
Reference in New Issue
Block a user