adapt behavior of cups printer to match other implementations
This commit is contained in:
parent
5c5acff16c
commit
b634354c99
@ -205,9 +205,9 @@ class CupsPrinter(Escpos):
|
||||
"""
|
||||
printer = self.printers.get(self.printer_name, {})
|
||||
state = printer.get("printer-state")
|
||||
if not state:
|
||||
return b""
|
||||
return bytes((state,))
|
||||
if not state or state in [4, 5]:
|
||||
return b"8" # offline
|
||||
return b"0" # online
|
||||
|
||||
def close(self) -> None:
|
||||
"""Close CUPS connection.
|
||||
|
@ -170,7 +170,7 @@ def test_read_no_device(cupsprinter) -> None:
|
||||
"""
|
||||
GIVEN a cups printer object
|
||||
WHEN device is None
|
||||
THEN check the return value is b''
|
||||
THEN check the return value is b'8'
|
||||
"""
|
||||
cupsprinter.device = None
|
||||
assert cupsprinter._read() == b""
|
||||
assert cupsprinter._read() == b"8"
|
||||
|
Loading…
x
Reference in New Issue
Block a user