From a7713f3dcb03223abdfc2fb7caf6cf2c735b2583 Mon Sep 17 00:00:00 2001 From: kaizersoje <54566217+kaizersoje@users.noreply.github.com> Date: Wed, 2 Feb 2022 10:44:00 +1100 Subject: [PATCH 1/3] Add amazon.com.au and update auspost_delivering Added amazon.com.au domain and updated subject for auspost_delivering as the subject in the emails either say "Your delivery from XXX is on its way" or "Your delivery from XXX is coming today" --- custom_components/mail_and_packages/const.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/custom_components/mail_and_packages/const.py b/custom_components/mail_and_packages/const.py index 26fa561b..3c5cec2b 100644 --- a/custom_components/mail_and_packages/const.py +++ b/custom_components/mail_and_packages/const.py @@ -68,7 +68,7 @@ DEFAULT_AMAZON_DAYS = 3 # Amazon -AMAZON_DOMAINS = "amazon.com,amazon.ca,amazon.co.uk,amazon.in,amazon.de,amazon.it" +AMAZON_DOMAINS = "amazon.com,amazon.ca,amazon.co.uk,amazon.in,amazon.de,amazon.it,amazon.com.au" AMAZON_DELIVERED_SUBJECT = ["Delivered: Your", "Consegna effettuata:"] AMAZON_SHIPMENT_TRACKING = ["shipment-tracking", "conferma-spedizione"] AMAZON_EMAIL = "order-update@" @@ -208,7 +208,7 @@ }, "auspost_delivering": { "email": ["noreply@notifications.auspost.com.au"], - "subject": ["Your delivery is coming today"], + "subject": ["is on its way", "is coming today"], }, "auspost_packages": {}, "auspost_tracking": {"pattern": ["\\d{7,10,12}|[A-Za-z]{2}[0-9]{9}AU "]}, From a4cac44e875027212f472a7919c226e59a3db8cc Mon Sep 17 00:00:00 2001 From: Chris Date: Mon, 7 Feb 2022 10:33:45 -0700 Subject: [PATCH 2/3] Fix tests --- tests/test_helpers.py | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/tests/test_helpers.py b/tests/test_helpers.py index 8faa70d2..557a4719 100644 --- a/tests/test_helpers.py +++ b/tests/test_helpers.py @@ -812,7 +812,7 @@ async def test_amazon_search_results(hass, mock_imap_amazon_shipped): result = amazon_search( mock_imap_amazon_shipped, "test/path", hass, "testfilename.jpg" ) - assert result == 12 + assert result == 14 async def test_amazon_search_delivered( @@ -821,7 +821,7 @@ async def test_amazon_search_delivered( result = amazon_search( mock_imap_amazon_delivered, "test/path", hass, "testfilename.jpg" ) - assert result == 12 + assert result == 14 assert mock_download_img.called @@ -831,7 +831,7 @@ async def test_amazon_search_delivered_it( result = amazon_search( mock_imap_amazon_delivered_it, "test/path", hass, "testfilename.jpg" ) - assert result == 12 + assert result == 14 async def test_amazon_hub(hass, mock_imap_amazon_the_hub): @@ -1042,20 +1042,13 @@ async def test_image_file_name( async def test_amazon_exception(hass, mock_imap_amazon_exception, caplog): result = amazon_exception(mock_imap_amazon_exception, ['""']) - assert result["order"] == [ - "123-1234567-1234567", - "123-1234567-1234567", - "123-1234567-1234567", - "123-1234567-1234567", - "123-1234567-1234567", - "123-1234567-1234567", - ] - assert result["count"] == 6 + assert result["order"] == ["123-1234567-1234567"]*7 + assert result["count"] == 7 result = amazon_exception(mock_imap_amazon_exception, ["testemail@fakedomain.com"]) - assert result["count"] == 7 + assert result["count"] == 8 assert ( - "Amazon domains to be checked: ['amazon.com', 'amazon.ca', 'amazon.co.uk', 'amazon.in', 'amazon.de', 'amazon.it', 'testemail@fakedomain.com']" + "Amazon domains to be checked: ['amazon.com', 'amazon.ca', 'amazon.co.uk', 'amazon.in', 'amazon.de', 'amazon.it', 'amazon.com.au', 'testemail@fakedomain.com']" in caplog.text ) @@ -1107,4 +1100,4 @@ async def test_email_search_none(mock_imap_search_error_none, caplog): async def test_amazon_shipped_fwd(hass, mock_imap_amazon_fwd,caplog): result = get_items(mock_imap_amazon_fwd, "order") assert result == ["123-1234567-1234567"] - assert "Arrive Date: Tuesday, January 11" in caplog.text \ No newline at end of file + assert "Arrive Date: Tuesday, January 11" in caplog.text From cf06ca8167f4db388438004a2ade9608e1c96a4c Mon Sep 17 00:00:00 2001 From: Chris Date: Mon, 7 Feb 2022 10:37:31 -0700 Subject: [PATCH 3/3] Fix pip --- .github/workflows/pytest.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pytest.yaml b/.github/workflows/pytest.yaml index 70af2516..535fe782 100644 --- a/.github/workflows/pytest.yaml +++ b/.github/workflows/pytest.yaml @@ -24,7 +24,7 @@ jobs: python-version: ${{ matrix.python-version }} - name: Install dependencies run: | - pip install -r requirements_test.txt + pip install --use-deprecated legacy-resolver -r requirements_test.txt sudo apt-get update sudo apt-get -y install language-pack-it - name: Generate coverage report