From 741610848944ad42b7d2a2f25873fb366b16a5b0 Mon Sep 17 00:00:00 2001 From: onyx-and-iris Date: Mon, 7 Aug 2023 16:31:19 +0100 Subject: [PATCH] add error tests --- tests/test_errors.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 tests/test_errors.py diff --git a/tests/test_errors.py b/tests/test_errors.py new file mode 100644 index 0000000..90e6643 --- /dev/null +++ b/tests/test_errors.py @@ -0,0 +1,26 @@ +import pytest + +import vban_cmd +from tests import data, vban + + +class TestErrors: + __test__ = True + + def test_it_tests_an_unknown_kind(self): + with pytest.raises( + vban_cmd.error.VBANCMDError, + match=f"Unknown Voicemeeter kind 'unknown_kind'", + ): + vban_cmd.api("unknown_kind") + + def test_it_tests_an_invalid_config(self): + EXPECTED_MSG = ( + f"No config with name 'unknown' is loaded into memory", + f"Known configs: {list(vban.configs.keys())}", + ) + with pytest.raises(vban_cmd.error.VBANCMDError) as exc_info: + vban.apply_config("unknown") + + e = exc_info.value + assert e.message == "\n".join(EXPECTED_MSG)