From 3848a7df64f33f9015bb5b18f4aa07e6ba041b2c Mon Sep 17 00:00:00 2001 From: "firstof9@gmail.com" Date: Sat, 22 Jun 2024 17:53:45 -0700 Subject: [PATCH] fix test --- custom_components/mail_and_packages/helpers.py | 4 +++- tests/test_helpers.py | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/custom_components/mail_and_packages/helpers.py b/custom_components/mail_and_packages/helpers.py index 42db1729..a6463b5e 100644 --- a/custom_components/mail_and_packages/helpers.py +++ b/custom_components/mail_and_packages/helpers.py @@ -1166,7 +1166,9 @@ def get_amazon_image( hass.add_job(download_img(hass, img_url, image_path, image_name)) -async def download_img(hass: HomeAssistant, img_url: str, img_path: str, img_name: str) -> None: +async def download_img( + hass: HomeAssistant, img_url: str, img_path: str, img_name: str +) -> None: """Download image from url.""" img_path = f"{img_path}amazon/" filepath = f"{img_path}{img_name}" diff --git a/tests/test_helpers.py b/tests/test_helpers.py index a727abb9..475167df 100644 --- a/tests/test_helpers.py +++ b/tests/test_helpers.py @@ -948,6 +948,7 @@ async def test_usps_exception(hass, mock_imap_usps_exception): @pytest.mark.asyncio async def test_download_img( + hass, aioclient_mock, mock_osremove, mock_osmakedir, @@ -960,6 +961,7 @@ async def test_download_img( m_open = mock_open() with patch("builtins.open", m_open, create=True): await download_img( + hass, "http://fake.website.com/not/a/real/website/image.jpg", "/fake/directory/", "testfilename.jpg",