2023-08-13 18:16:49 +01:00
|
|
|
import re
|
|
|
|
|
2023-08-07 16:31:19 +01:00
|
|
|
import pytest
|
|
|
|
|
|
|
|
import vban_cmd
|
2025-01-17 15:01:40 +00:00
|
|
|
from tests import vban
|
2023-08-07 16:31:19 +01:00
|
|
|
|
|
|
|
|
|
|
|
class TestErrors:
|
|
|
|
__test__ = True
|
|
|
|
|
|
|
|
def test_it_tests_an_unknown_kind(self):
|
|
|
|
with pytest.raises(
|
|
|
|
vban_cmd.error.VBANCMDError,
|
2025-01-17 15:01:40 +00:00
|
|
|
match="Unknown Voicemeeter kind 'unknown_kind'",
|
2023-08-07 16:31:19 +01:00
|
|
|
):
|
2025-01-17 15:01:40 +00:00
|
|
|
vban_cmd.api('unknown_kind')
|
2023-08-07 16:31:19 +01:00
|
|
|
|
2023-08-09 17:03:55 +01:00
|
|
|
def test_it_tests_an_unknown_config_name(self):
|
2025-01-17 15:01:40 +00:00
|
|
|
EXPECTED_MSG = '\n'.join(
|
2023-08-13 18:16:49 +01:00
|
|
|
(
|
2025-01-17 15:01:40 +00:00
|
|
|
"No config with name 'unknown' is loaded into memory",
|
|
|
|
f'Known configs: {list(vban.configs.keys())}',
|
2023-08-13 18:16:49 +01:00
|
|
|
)
|
2023-08-07 16:31:19 +01:00
|
|
|
)
|
2023-08-13 18:16:49 +01:00
|
|
|
with pytest.raises(vban_cmd.error.VBANCMDError, match=re.escape(EXPECTED_MSG)):
|
2025-01-17 15:01:40 +00:00
|
|
|
vban.apply_config('unknown')
|
2023-08-07 16:31:19 +01:00
|
|
|
|
2023-08-09 17:03:55 +01:00
|
|
|
def test_it_tests_an_invalid_config_key(self):
|
|
|
|
CONFIG = {
|
2025-01-17 15:01:40 +00:00
|
|
|
'strip-0': {'A1': True, 'B1': True, 'gain': -6.0},
|
|
|
|
'bus-0': {'mute': True, 'eq': {'on': True}},
|
|
|
|
'unknown-0': {'state': True},
|
|
|
|
'vban-out-1': {'name': 'streamname'},
|
2023-08-09 17:03:55 +01:00
|
|
|
}
|
2023-08-10 19:12:52 +01:00
|
|
|
with pytest.raises(ValueError, match="invalid config key 'unknown-0'"):
|
2023-08-09 17:03:55 +01:00
|
|
|
vban.apply(CONFIG)
|