Skip to content

Commit

Permalink
linting
Browse files Browse the repository at this point in the history
  • Loading branch information
firstof9 committed Sep 16, 2022
1 parent d787cd2 commit db5c78f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
4 changes: 2 additions & 2 deletions custom_components/mail_and_packages/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@
"subject": ["is now with your local Evri courier for delivery"],
},
"evri_packages": {},
"evri_tracking": {"pattern": ["H[0-9A-Z]{15}"]}
"evri_tracking": {"pattern": ["H[0-9A-Z]{15}"]},
}

# Sensor definitions
Expand Down Expand Up @@ -699,7 +699,7 @@
native_unit_of_measurement="package(s)",
icon="mdi:package-variant-closed",
key="evri_packages",
),
),
###
# !!! Insert new sensors above these two !!!
###
Expand Down
9 changes: 7 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -936,6 +936,7 @@ def mock_image_excpetion():
mock_image_excpetion.open.side_effect = Exception("SystemError")
yield mock_image_excpetion


@pytest.fixture
def mock_image_save_excpetion():
"""Fixture to mock Image."""
Expand All @@ -946,12 +947,15 @@ def mock_image_save_excpetion():
mock_image_save_excpetion.Image.save.side_effect = Exception("ValueError")
yield mock_image_save_excpetion


@pytest.fixture
def mock_resizeimage():
"""Fixture to mock splitext."""
with patch(
"custom_components.mail_and_packages.helpers.Image"
) as mock_resizeimage, patch("custom_components.mail_and_packages.helpers.ImageOps"):
) as mock_resizeimage, patch(
"custom_components.mail_and_packages.helpers.ImageOps"
):

yield mock_resizeimage

Expand Down Expand Up @@ -1033,6 +1037,7 @@ def mock_imap_hermes_out_for_delivery():
mock_conn.select.return_value = ("OK", [])
yield mock_conn


@pytest.fixture()
def mock_imap_evri_out_for_delivery():
"""Mock imap class values."""
Expand All @@ -1056,7 +1061,7 @@ def mock_imap_evri_out_for_delivery():
email_file = f.read()
mock_conn.fetch.return_value = ("OK", [(b"", email_file.encode("utf-8"))])
mock_conn.select.return_value = ("OK", [])
yield mock_conn
yield mock_conn


@pytest.fixture()
Expand Down
1 change: 1 addition & 0 deletions tests/test_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -713,6 +713,7 @@ async def test_hermes_out_for_delivery(hass, mock_imap_hermes_out_for_delivery):
assert result["count"] == 1
assert result["tracking"] == ["8888888888888888"]


async def test_evri_out_for_delivery(hass, mock_imap_evri_out_for_delivery):
result = get_count(
mock_imap_evri_out_for_delivery, "evri_delivering", True, "./", hass
Expand Down

0 comments on commit db5c78f

Please sign in to comment.