mirror of
https://github.com/onyx-and-iris/vban-cmd-python.git
synced 2025-01-18 10:30:48 +00:00
stip.{comp,gate} tests added to higher
This commit is contained in:
parent
3f5dc7c376
commit
df7996a846
@ -3,23 +3,21 @@ import sys
|
|||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
|
|
||||||
import vban_cmd
|
import vban_cmd
|
||||||
from vban_cmd.kinds import KindId, kinds_all
|
from vban_cmd.kinds import KindId
|
||||||
from vban_cmd.kinds import request_kind_map as kindmap
|
from vban_cmd.kinds import request_kind_map as kindmap
|
||||||
|
|
||||||
# let's keep things random
|
# let's keep things random
|
||||||
kind_id = random.choice(tuple(kind_id.name.lower() for kind_id in KindId))
|
KIND_ID = random.choice(tuple(kind_id.name.lower() for kind_id in KindId))
|
||||||
|
|
||||||
opts = {
|
opts = {
|
||||||
"ip": "ws.local",
|
"ip": "testing.local",
|
||||||
"streamname": "workstation",
|
"streamname": "testing",
|
||||||
"port": 6990,
|
"port": 6990,
|
||||||
"bps": 0,
|
"bps": 0,
|
||||||
"sync": True,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
vbans = {kind.name: vban_cmd.api(kind.name, **opts) for kind in kinds_all}
|
vban = vban_cmd.api(KIND_ID, **opts)
|
||||||
tests = vbans[kind_id]
|
kind = kindmap(KIND_ID)
|
||||||
kind = kindmap(kind_id)
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
@ -42,9 +40,9 @@ data = Data()
|
|||||||
|
|
||||||
def setup_module():
|
def setup_module():
|
||||||
print(f"\nRunning tests for kind [{data.name}]\n", file=sys.stdout)
|
print(f"\nRunning tests for kind [{data.name}]\n", file=sys.stdout)
|
||||||
tests.login()
|
vban.login()
|
||||||
tests.command.reset()
|
vban.command.reset()
|
||||||
|
|
||||||
|
|
||||||
def teardown_module():
|
def teardown_module():
|
||||||
tests.logout()
|
vban.logout()
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
import time
|
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from tests import data, tests
|
from tests import data, vban
|
||||||
|
|
||||||
|
|
||||||
class TestSetAndGetBoolHigher:
|
class TestSetAndGetBoolHigher:
|
||||||
@ -12,18 +10,18 @@ class TestSetAndGetBoolHigher:
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setup_class(cls):
|
def setup_class(cls):
|
||||||
tests.apply_config("example")
|
vban.apply_config("example")
|
||||||
|
|
||||||
def test_it_tests_config_string(self):
|
def test_it_tests_config_string(self):
|
||||||
assert "PhysStrip" in tests.strip[data.phys_in].label
|
assert "PhysStrip" in vban.strip[data.phys_in].label
|
||||||
assert "VirtStrip" in tests.strip[data.virt_in].label
|
assert "VirtStrip" in vban.strip[data.virt_in].label
|
||||||
|
|
||||||
def test_it_tests_config_bool(self):
|
def test_it_tests_config_bool(self):
|
||||||
assert tests.strip[0].A1 == True
|
assert vban.strip[0].A1 == True
|
||||||
|
|
||||||
@pytest.mark.skipif(
|
@pytest.mark.skipif(
|
||||||
"not config.getoption('--run-slow')",
|
"not config.getoption('--run-slow')",
|
||||||
reason="Only run when --run-slow is given",
|
reason="Only run when --run-slow is given",
|
||||||
)
|
)
|
||||||
def test_it_tests_config_busmode(self):
|
def test_it_tests_config_busmode(self):
|
||||||
assert tests.bus[data.phys_out].mode.get() == "composite"
|
assert vban.bus[data.phys_out].mode.get() == "composite"
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from tests import data, tests
|
from tests import data, vban
|
||||||
|
|
||||||
|
|
||||||
class TestRemoteFactories:
|
class TestRemoteFactories:
|
||||||
@ -11,33 +11,33 @@ class TestRemoteFactories:
|
|||||||
reason="Skip test if kind is not basic",
|
reason="Skip test if kind is not basic",
|
||||||
)
|
)
|
||||||
def test_it_tests_remote_attrs_for_basic(self):
|
def test_it_tests_remote_attrs_for_basic(self):
|
||||||
assert hasattr(tests, "strip")
|
assert hasattr(vban, "strip")
|
||||||
assert hasattr(tests, "bus")
|
assert hasattr(vban, "bus")
|
||||||
assert hasattr(tests, "command")
|
assert hasattr(vban, "command")
|
||||||
|
|
||||||
assert len(tests.strip) == 3
|
assert len(vban.strip) == 3
|
||||||
assert len(tests.bus) == 2
|
assert len(vban.bus) == 2
|
||||||
|
|
||||||
@pytest.mark.skipif(
|
@pytest.mark.skipif(
|
||||||
data.name != "banana",
|
data.name != "banana",
|
||||||
reason="Skip test if kind is not basic",
|
reason="Skip test if kind is not basic",
|
||||||
)
|
)
|
||||||
def test_it_tests_remote_attrs_for_banana(self):
|
def test_it_tests_remote_attrs_for_banana(self):
|
||||||
assert hasattr(tests, "strip")
|
assert hasattr(vban, "strip")
|
||||||
assert hasattr(tests, "bus")
|
assert hasattr(vban, "bus")
|
||||||
assert hasattr(tests, "command")
|
assert hasattr(vban, "command")
|
||||||
|
|
||||||
assert len(tests.strip) == 5
|
assert len(vban.strip) == 5
|
||||||
assert len(tests.bus) == 5
|
assert len(vban.bus) == 5
|
||||||
|
|
||||||
@pytest.mark.skipif(
|
@pytest.mark.skipif(
|
||||||
data.name != "potato",
|
data.name != "potato",
|
||||||
reason="Skip test if kind is not basic",
|
reason="Skip test if kind is not basic",
|
||||||
)
|
)
|
||||||
def test_it_tests_remote_attrs_for_potato(self):
|
def test_it_tests_remote_attrs_for_potato(self):
|
||||||
assert hasattr(tests, "strip")
|
assert hasattr(vban, "strip")
|
||||||
assert hasattr(tests, "bus")
|
assert hasattr(vban, "bus")
|
||||||
assert hasattr(tests, "command")
|
assert hasattr(vban, "command")
|
||||||
|
|
||||||
assert len(tests.strip) == 8
|
assert len(vban.strip) == 8
|
||||||
assert len(tests.bus) == 8
|
assert len(vban.bus) == 8
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from tests import data, tests
|
from tests import data, vban
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize("value", [False, True])
|
@pytest.mark.parametrize("value", [False, True])
|
||||||
@ -17,8 +17,8 @@ class TestSetAndGetBoolHigher:
|
|||||||
],
|
],
|
||||||
)
|
)
|
||||||
def test_it_sets_and_gets_strip_bool_params(self, index, param, value):
|
def test_it_sets_and_gets_strip_bool_params(self, index, param, value):
|
||||||
setattr(tests.strip[index], param, value)
|
setattr(vban.strip[index], param, value)
|
||||||
assert getattr(tests.strip[index], param) == value
|
assert getattr(vban.strip[index], param) == value
|
||||||
|
|
||||||
@pytest.mark.skipif(
|
@pytest.mark.skipif(
|
||||||
data.name == "banana",
|
data.name == "banana",
|
||||||
@ -31,8 +31,8 @@ class TestSetAndGetBoolHigher:
|
|||||||
],
|
],
|
||||||
)
|
)
|
||||||
def test_it_sets_and_gets_strip_bool_params_mc(self, index, param, value):
|
def test_it_sets_and_gets_strip_bool_params_mc(self, index, param, value):
|
||||||
setattr(tests.strip[index], param, value)
|
setattr(vban.strip[index], param, value)
|
||||||
assert getattr(tests.strip[index], param) == value
|
assert getattr(vban.strip[index], param) == value
|
||||||
|
|
||||||
""" bus tests, physical and virtual """
|
""" bus tests, physical and virtual """
|
||||||
|
|
||||||
@ -46,8 +46,8 @@ class TestSetAndGetBoolHigher:
|
|||||||
],
|
],
|
||||||
)
|
)
|
||||||
def test_it_sets_and_gets_bus_bool_params(self, index, param, value):
|
def test_it_sets_and_gets_bus_bool_params(self, index, param, value):
|
||||||
setattr(tests.bus[index], param, value)
|
setattr(vban.bus[index], param, value)
|
||||||
assert getattr(tests.bus[index], param) == value
|
assert getattr(vban.bus[index], param) == value
|
||||||
|
|
||||||
""" bus modes tests, physical and virtual """
|
""" bus modes tests, physical and virtual """
|
||||||
|
|
||||||
@ -66,8 +66,8 @@ class TestSetAndGetBoolHigher:
|
|||||||
# here it only makes sense to set/get bus modes as True
|
# here it only makes sense to set/get bus modes as True
|
||||||
if not value:
|
if not value:
|
||||||
value = True
|
value = True
|
||||||
setattr(tests.bus[index].mode, param, value)
|
setattr(vban.bus[index].mode, param, value)
|
||||||
assert getattr(tests.bus[index].mode, param) == value
|
assert getattr(vban.bus[index].mode, param) == value
|
||||||
|
|
||||||
""" command tests """
|
""" command tests """
|
||||||
|
|
||||||
@ -76,7 +76,7 @@ class TestSetAndGetBoolHigher:
|
|||||||
[("lock")],
|
[("lock")],
|
||||||
)
|
)
|
||||||
def test_it_sets_command_bool_params(self, param, value):
|
def test_it_sets_command_bool_params(self, param, value):
|
||||||
setattr(tests.command, param, value)
|
setattr(vban.command, param, value)
|
||||||
|
|
||||||
|
|
||||||
class TestSetAndGetIntHigher:
|
class TestSetAndGetIntHigher:
|
||||||
@ -94,8 +94,8 @@ class TestSetAndGetIntHigher:
|
|||||||
],
|
],
|
||||||
)
|
)
|
||||||
def test_it_sets_and_gets_strip_bool_params(self, index, param, value):
|
def test_it_sets_and_gets_strip_bool_params(self, index, param, value):
|
||||||
setattr(tests.strip[index], param, value)
|
setattr(vban.strip[index], param, value)
|
||||||
assert getattr(tests.strip[index], param) == value
|
assert getattr(vban.strip[index], param) == value
|
||||||
|
|
||||||
|
|
||||||
class TestSetAndGetFloatHigher:
|
class TestSetAndGetFloatHigher:
|
||||||
@ -113,15 +113,15 @@ class TestSetAndGetFloatHigher:
|
|||||||
],
|
],
|
||||||
)
|
)
|
||||||
def test_it_sets_and_gets_strip_float_params(self, index, param, value):
|
def test_it_sets_and_gets_strip_float_params(self, index, param, value):
|
||||||
setattr(tests.strip[index], param, value)
|
setattr(vban.strip[index], param, value)
|
||||||
assert getattr(tests.strip[index], param) == value
|
assert getattr(vban.strip[index], param) == value
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"index,value",
|
"index,value",
|
||||||
[(data.phys_in, 2), (data.phys_in, 2), (data.virt_in, 8), (data.virt_in, 8)],
|
[(data.phys_in, 2), (data.phys_in, 2), (data.virt_in, 8), (data.virt_in, 8)],
|
||||||
)
|
)
|
||||||
def test_it_gets_prefader_levels_and_compares_length_of_array(self, index, value):
|
def test_it_gets_prefader_levels_and_compares_length_of_array(self, index, value):
|
||||||
assert len(tests.strip[index].levels.prefader) == value
|
assert len(vban.strip[index].levels.prefader) == value
|
||||||
|
|
||||||
@pytest.mark.skipif(
|
@pytest.mark.skipif(
|
||||||
data.name != "potato",
|
data.name != "potato",
|
||||||
@ -137,8 +137,8 @@ class TestSetAndGetFloatHigher:
|
|||||||
],
|
],
|
||||||
)
|
)
|
||||||
def test_it_sets_and_gets_strip_gainlayer_values(self, index, j, value):
|
def test_it_sets_and_gets_strip_gainlayer_values(self, index, j, value):
|
||||||
tests.strip[index].gainlayer[j].gain = value
|
vban.strip[index].gainlayer[j].gain = value
|
||||||
assert tests.strip[index].gainlayer[j].gain == value
|
assert vban.strip[index].gainlayer[j].gain == value
|
||||||
|
|
||||||
""" strip tests, virtual """
|
""" strip tests, virtual """
|
||||||
|
|
||||||
@ -151,8 +151,8 @@ class TestSetAndGetFloatHigher:
|
|||||||
],
|
],
|
||||||
)
|
)
|
||||||
def test_it_sets_and_gets_strip_eq_params(self, index, param, value):
|
def test_it_sets_and_gets_strip_eq_params(self, index, param, value):
|
||||||
setattr(tests.strip[index], param, value)
|
setattr(vban.strip[index], param, value)
|
||||||
assert getattr(tests.strip[index], param) == value
|
assert getattr(vban.strip[index], param) == value
|
||||||
|
|
||||||
""" bus tests, physical and virtual """
|
""" bus tests, physical and virtual """
|
||||||
|
|
||||||
@ -161,15 +161,15 @@ class TestSetAndGetFloatHigher:
|
|||||||
[(data.phys_out, "gain", -3.6), (data.virt_out, "gain", 5.8)],
|
[(data.phys_out, "gain", -3.6), (data.virt_out, "gain", 5.8)],
|
||||||
)
|
)
|
||||||
def test_it_sets_and_gets_bus_float_params(self, index, param, value):
|
def test_it_sets_and_gets_bus_float_params(self, index, param, value):
|
||||||
setattr(tests.bus[index], param, value)
|
setattr(vban.bus[index], param, value)
|
||||||
assert getattr(tests.bus[index], param) == value
|
assert getattr(vban.bus[index], param) == value
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"index,value",
|
"index,value",
|
||||||
[(data.phys_out, 8), (data.virt_out, 8)],
|
[(data.phys_out, 8), (data.virt_out, 8)],
|
||||||
)
|
)
|
||||||
def test_it_gets_prefader_levels_and_compares_length_of_array(self, index, value):
|
def test_it_gets_prefader_levels_and_compares_length_of_array(self, index, value):
|
||||||
assert len(tests.bus[index].levels.all) == value
|
assert len(vban.bus[index].levels.all) == value
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize("value", ["test0", "test1"])
|
@pytest.mark.parametrize("value", ["test0", "test1"])
|
||||||
@ -183,8 +183,8 @@ class TestSetAndGetStringHigher:
|
|||||||
[(data.phys_in, "label"), (data.virt_in, "label")],
|
[(data.phys_in, "label"), (data.virt_in, "label")],
|
||||||
)
|
)
|
||||||
def test_it_sets_and_gets_strip_string_params(self, index, param, value):
|
def test_it_sets_and_gets_strip_string_params(self, index, param, value):
|
||||||
setattr(tests.strip[index], param, value)
|
setattr(vban.strip[index], param, value)
|
||||||
assert getattr(tests.strip[index], param) == value
|
assert getattr(vban.strip[index], param) == value
|
||||||
|
|
||||||
""" bus tests, physical and virtual """
|
""" bus tests, physical and virtual """
|
||||||
|
|
||||||
@ -193,5 +193,5 @@ class TestSetAndGetStringHigher:
|
|||||||
[(data.phys_out, "label"), (data.virt_out, "label")],
|
[(data.phys_out, "label"), (data.virt_out, "label")],
|
||||||
)
|
)
|
||||||
def test_it_sets_and_gets_bus_string_params(self, index, param, value):
|
def test_it_sets_and_gets_bus_string_params(self, index, param, value):
|
||||||
setattr(tests.bus[index], param, value)
|
setattr(vban.bus[index], param, value)
|
||||||
assert getattr(tests.bus[index], param) == value
|
assert getattr(vban.bus[index], param) == value
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import time
|
import time
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from vban_cmd import kinds
|
|
||||||
|
|
||||||
from tests import data, tests
|
from tests import data, vban
|
||||||
|
from vban_cmd import kinds
|
||||||
|
|
||||||
|
|
||||||
class TestPublicPacketLower:
|
class TestPublicPacketLower:
|
||||||
@ -12,7 +12,7 @@ class TestPublicPacketLower:
|
|||||||
"""Tests for a valid rt data packet"""
|
"""Tests for a valid rt data packet"""
|
||||||
|
|
||||||
def test_it_gets_an_rt_data_packet(self):
|
def test_it_gets_an_rt_data_packet(self):
|
||||||
assert tests.public_packet.voicemeetertype in (
|
assert vban.public_packet.voicemeetertype in (
|
||||||
kind.name for kind in kinds.kinds_all
|
kind.name for kind in kinds.kinds_all
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -35,7 +35,7 @@ class TestSetRT:
|
|||||||
],
|
],
|
||||||
)
|
)
|
||||||
def test_it_sends_a_text_request(self, kls, index, param, value):
|
def test_it_sends_a_text_request(self, kls, index, param, value):
|
||||||
tests._set_rt(f"{kls}[{index}]", param, value)
|
vban._set_rt(f"{kls}[{index}]", param, value)
|
||||||
time.sleep(0.02)
|
time.sleep(0.02)
|
||||||
target = getattr(tests, kls)[index]
|
target = getattr(vban, kls)[index]
|
||||||
assert getattr(target, param) == bool(value)
|
assert getattr(target, param) == bool(value)
|
||||||
|
Loading…
Reference in New Issue
Block a user