Skip to content

Commit

Permalink
Fix branch issue
Browse files Browse the repository at this point in the history
  • Loading branch information
bieniu committed Mar 21, 2020
1 parent 7460d66 commit d100447
Show file tree
Hide file tree
Showing 12 changed files with 15 additions and 12 deletions.
5 changes: 4 additions & 1 deletion brother/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

_LOGGER = logging.getLogger(__name__)

REGEX_MODEL_PATTERN = re.compile(r"MODEL=\"(?P<model>[\w\-]+)( series)?\"")
REGEX_MODEL_PATTERN = re.compile(r"MDL:(?P<model>[\w\-]+)")


class Brother: # pylint:disable=too-many-instance-attributes
Expand Down Expand Up @@ -55,13 +55,16 @@ async def async_update(self):
self.model = re.search(
REGEX_MODEL_PATTERN, raw_data[OIDS[ATTR_MODEL]]
).group("model")
data[ATTR_MODEL] = self.model
self.serial = raw_data[OIDS[ATTR_SERIAL]]
data[ATTR_SERIAL] = self.serial
except (TypeError, AttributeError):
raise UnsupportedModel(
"It seems that this printer model is not supported. Sorry."
)
try:
self.firmware = raw_data[OIDS[ATTR_FIRMWARE]]
data[ATTR_FIRMWARE] = self.firmware
code_page = chardet.detect(raw_data[OIDS[ATTR_STATUS]].encode("latin1"))[
"encoding"
]
Expand Down
2 changes: 1 addition & 1 deletion brother/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
ATTR_COUNTERS: "1.3.6.1.4.1.2435.2.3.9.4.2.1.5.5.10.0",
ATTR_FIRMWARE: "1.3.6.1.4.1.2435.2.3.9.4.2.1.5.5.17.0",
ATTR_MAINTENANCE: "1.3.6.1.4.1.2435.2.3.9.4.2.1.5.5.8.0",
ATTR_MODEL: "1.3.6.1.4.1.2435.2.4.3.99.3.1.6.1.2.1",
ATTR_MODEL: "1.3.6.1.4.1.2435.2.3.9.1.1.7.0",
ATTR_NEXTCARE: "1.3.6.1.4.1.2435.2.3.9.4.2.1.5.5.11.0",
ATTR_PAGE_COUNT: "1.3.6.1.2.1.43.10.2.1.4.1.1",
ATTR_SERIAL: "1.3.6.1.4.1.2435.2.3.9.4.2.1.5.5.1.0",
Expand Down
2 changes: 1 addition & 1 deletion pytest.ini
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[pytest]
addopts=--cov --cov-report term-missing
addopts=--cov --cov-report term-missing --disable-pytest-warnings
2 changes: 1 addition & 1 deletion tests/data/dcp-9020cdw.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"1.3.6.1.4.1.2435.2.4.3.99.3.1.6.1.2.1": "MODEL=\"DCP-9020CDW series\"",
"1.3.6.1.4.1.2435.2.3.9.1.1.7.0": "MFG:Brother;CMD:PJL,HBP,URF;MDL:DCP-9020CDW series;CLS:PRINTER;CID:Brother Laser Type1;",
"1.3.6.1.4.1.2435.2.3.9.4.2.1.5.5.10.0": [
"0001040000134b",
"02010400000c69",
Expand Down
2 changes: 1 addition & 1 deletion tests/data/dcp-j132w.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"1.3.6.1.4.1.2435.2.3.9.4.2.1.5.5.1.0": "serial_number",
"1.3.6.1.4.1.2435.2.3.9.4.2.1.5.4.5.2.0": "TRYB U¦PIENIA ",
"1.3.6.1.4.1.2435.2.4.3.99.3.1.6.1.2.1": "MODEL=\"DCP-J132W series\"",
"1.3.6.1.4.1.2435.2.3.9.1.1.7.0": "MFG:Brother;CMD:PJL,HBP,URF;MDL:DCP-J132W;CLS:PRINTER;",
"1.3.6.1.4.1.2435.2.3.9.4.2.1.5.5.17.0": "Q1906110144",
"1.3.6.1.4.1.2435.2.3.9.4.2.1.5.5.10.0": ["0001040000036f"],
"1.3.6.1.4.1.2435.2.3.9.4.2.1.5.5.8.0": [
Expand Down
2 changes: 1 addition & 1 deletion tests/data/dcp-l2540dn.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"8101040000003c",
"86010400000010"
],
"1.3.6.1.4.1.2435.2.4.3.99.3.1.6.1.2.1": "MODEL=\"DCP-L2540DN series\"",
"1.3.6.1.4.1.2435.2.3.9.1.1.7.0": "MFG:Brother;CMD:PJL,HBP,URF;MDL:DCP-L2540DN series;CLS:PRINTER;CID:Brother Laser Type1;",
"1.3.6.1.4.1.2435.2.3.9.4.2.1.5.5.11.0": ["82010400002d93"],
"1.3.6.1.2.1.43.10.2.1.4.1.1": "333",
"1.3.6.1.4.1.2435.2.3.9.4.2.1.5.5.1.0": "serial_number",
Expand Down
2 changes: 1 addition & 1 deletion tests/data/dcp-l3550cdw.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"1.3.6.1.4.1.2435.2.3.9.4.2.1.5.5.1.0": "serial_number",
"1.3.6.1.4.1.2435.2.3.9.4.2.1.5.4.5.2.0": "Ma³o toneru (Y) ",
"1.3.6.1.4.1.2435.2.4.3.99.3.1.6.1.2.1": "MODEL=\"DCP-L3550CDW series\"",
"1.3.6.1.4.1.2435.2.3.9.1.1.7.0": "MFG:Brother;CMD:PJL,HBP,URF;MDL:DCP-L3550CDW;CLS:PRINTER;CID:Brother Laser Type1;",
"1.3.6.1.4.1.2435.2.3.9.4.2.1.5.5.17.0": "J1906051424",
"1.3.6.1.4.1.2435.2.3.9.4.2.1.5.5.10.0": [
"0001040000064b",
Expand Down
2 changes: 1 addition & 1 deletion tests/data/hl-l2340dw.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"81010400000050",
"8601040000000a"
],
"1.3.6.1.4.1.2435.2.4.3.99.3.1.6.1.2.1": "MODEL=\"HL-L2340DW\"",
"1.3.6.1.4.1.2435.2.3.9.1.1.7.0": "MFG:Brother;CMD:PJL,HBP,URF;MDL:HL-L2340DW series;CLS:PRINTER;CID:Brother Laser Type1;URF:W8,CP1,IS4-1,MT1-3-4-5-8,OB10,PQ4,RS300-600,V1.3,DM1;",
"1.3.6.1.4.1.2435.2.3.9.4.2.1.5.5.11.0": ["82010400002b06"],
"1.3.6.1.4.1.2435.2.3.9.4.2.1.5.5.1.0": "serial_number",
"1.3.6.1.4.1.2435.2.3.9.4.2.1.5.4.5.2.0": "OCZEKIWANIE "
Expand Down
2 changes: 1 addition & 1 deletion tests/data/incomplete.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"1.3.6.1.4.1.2435.2.3.9.4.2.1.5.5.1.0": "serial_number",
"1.3.6.1.4.1.2435.2.3.9.4.2.1.5.4.5.2.0": null,
"1.3.6.1.4.1.2435.2.4.3.99.3.1.6.1.2.1": "MODEL=\"DCP-L3550CDW series\"",
"1.3.6.1.4.1.2435.2.3.9.1.1.7.0": "MFG:Brother;CMD:PJL,HBP,URF;MDL:DCP-L3550CDW;CLS:PRINTER;",
"1.3.6.1.4.1.2435.2.3.9.4.2.1.5.5.17.0": null,
"1.3.6.1.4.1.2435.2.3.9.4.2.1.5.5.10.0": [],
"1.3.6.1.4.1.2435.2.3.9.4.2.1.5.5.8.0": [
Expand Down
2 changes: 1 addition & 1 deletion tests/data/invalid.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"1.3.6.1.4.1.2435.2.3.9.4.2.1.5.5.1.0": null,
"1.3.6.1.4.1.2435.2.3.9.4.2.1.5.4.5.2.0": null,
"1.3.6.1.4.1.2435.2.4.3.99.3.1.6.1.2.1": null,
"1.3.6.1.4.1.2435.2.3.9.1.1.7.0": null,
"1.3.6.1.4.1.2435.2.3.9.4.2.1.5.5.17.0": null,
"1.3.6.1.4.1.2435.2.3.9.4.2.1.5.5.10.0": [],
"1.3.6.1.4.1.2435.2.3.9.4.2.1.5.5.8.0": [],
Expand Down
2 changes: 1 addition & 1 deletion tests/data/mfc-j680dw.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"1.3.6.1.4.1.2435.2.3.9.4.2.1.5.5.10.0": ["010104000001cd", "020104000001eb"],
"1.3.6.1.4.1.2435.2.3.9.4.2.1.5.5.17.0": "U1804191714VER.J",
"1.3.6.1.4.1.2435.2.3.9.4.2.1.5.5.8.0": ["31010400000001", "32010400000001", "33010400000001", "34010400000001", "6f01040000125c", "70010400000dac", "71010400002134", "72010400001194", "8101040000002f", "82010400000023", "83010400000055", "8401040000002d", "86010400000012", "87010400000012", "88010400000012", "89010400000012"],
"1.3.6.1.4.1.2435.2.4.3.99.3.1.6.1.2.1": "MODEL=\"MFC-J680DW\"",
"1.3.6.1.4.1.2435.2.3.9.1.1.7.0": "MFG:Brother;CMD:PJL,HBP,URF;MDL:MFC-J680DW;CLS:PRINTER;",
"1.3.6.1.4.1.2435.2.3.9.4.2.1.5.5.11.0": [],
"1.3.6.1.4.1.2435.2.3.9.4.2.1.5.5.1.0": "serial_number",
"1.3.6.1.4.1.2435.2.3.9.4.2.1.5.4.5.2.0": "Ready"
Expand Down
2 changes: 1 addition & 1 deletion tests/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ async def test_dcp_l3550cdw_model():

with patch("brother.Brother._get_data", return_value=data):

brother = Brother(INVALID_HOST)
brother = Brother(HOST)
await brother.async_update()

assert brother.available == True
Expand Down

0 comments on commit d100447

Please sign in to comment.