check for wrong printer names
This commit is contained in:
parent
ab95f714a6
commit
2e9d5a9871
@ -31,8 +31,8 @@ def simple_printer_test(config):
|
|||||||
assert p.output == b"1234"
|
assert p.output == b"1234"
|
||||||
|
|
||||||
|
|
||||||
def test_config_load_with_invalid_config(tmp_path):
|
def test_config_load_with_invalid_config_yaml(tmp_path):
|
||||||
"""Test the loading of a config with a invalid config file."""
|
"""Test the loading of a config with a invalid config file (yaml issue)."""
|
||||||
# generate a dummy config
|
# generate a dummy config
|
||||||
config_file = tmp_path / "config.yaml"
|
config_file = tmp_path / "config.yaml"
|
||||||
generate_dummy_config(config_file, content="}invalid}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)
|
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):
|
def test_config_load_with_missing_config(tmp_path):
|
||||||
"""Test the loading of a config that does not exist."""
|
"""Test the loading of a config that does not exist."""
|
||||||
# test the config loading
|
# test the config loading
|
||||||
|
Loading…
x
Reference in New Issue
Block a user