diff --git a/test/test_config.py b/test/test_config.py index 878cb43..d536909 100644 --- a/test/test_config.py +++ b/test/test_config.py @@ -31,8 +31,8 @@ def simple_printer_test(config): assert p.output == b"1234" -def test_config_load_with_invalid_config(tmp_path): - """Test the loading of a config with a invalid config file.""" +def test_config_load_with_invalid_config_yaml(tmp_path): + """Test the loading of a config with a invalid config file (yaml issue).""" # generate a dummy config config_file = tmp_path / "config.yaml" generate_dummy_config(config_file, content="}invalid}yaml}") @@ -45,6 +45,22 @@ def test_config_load_with_invalid_config(tmp_path): c.load(config_path=config_file) +def test_config_load_with_invalid_config_content(tmp_path): + """Test the loading of a config with a invalid config file (content issue).""" + # generate a dummy config + config_file = tmp_path / "config.yaml" + generate_dummy_config( + config_file, content="printer:\n type: NoPrinterWithThatName\n" + ) + + # test the config loading + from escpos import config + + c = config.Config() + with pytest.raises(escpos.exceptions.ConfigSyntaxError): + c.load(config_path=config_file) + + def test_config_load_with_missing_config(tmp_path): """Test the loading of a config that does not exist.""" # test the config loading