Skip to content

Commit

Permalink
feat(shipper): add amazon.nl support (#926)
Browse files Browse the repository at this point in the history
* feat: add amazon.nl support

* update tests
  • Loading branch information
firstof9 authored Jun 24, 2024
1 parent 6076568 commit 0a4a180
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
4 changes: 4 additions & 0 deletions custom_components/mail_and_packages/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
"amazon.es",
"amazon.fr",
"amazon.ae",
"amazon.nl",
]
AMAZON_DELIVERED_SUBJECT = [
"Delivered: Your",
Expand All @@ -95,13 +96,16 @@
"Geliefert:",
"Livré",
"Entregado:",
"Bezorgd:",
]
AMAZON_SHIPMENT_TRACKING = [
"shipment-tracking",
"conferma-spedizione",
"confirmar-envio",
"versandbestaetigung",
"confirmation-commande",
"verzending-volgen",
"update-bestelling",
]
AMAZON_EMAIL = "order-update@"
AMAZON_PACKAGES = "amazon_packages"
Expand Down
14 changes: 7 additions & 7 deletions tests/test_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -781,7 +781,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 == 78
assert result == 98


@pytest.mark.asyncio
Expand All @@ -791,7 +791,7 @@ async def test_amazon_search_delivered(
result = amazon_search(
mock_imap_amazon_delivered, "test/path", hass, "testfilename.jpg"
)
assert result == 78
assert result == 98
assert mock_download_img.called


Expand All @@ -802,7 +802,7 @@ async def test_amazon_search_delivered_it(
result = amazon_search(
mock_imap_amazon_delivered_it, "test/path", hass, "testfilename.jpg"
)
assert result == 78
assert result == 98


@pytest.mark.asyncio
Expand Down Expand Up @@ -1035,13 +1035,13 @@ async def test_image_file_name(
@pytest.mark.asyncio
async def test_amazon_exception(hass, mock_imap_amazon_exception, caplog):
result = amazon_exception(mock_imap_amazon_exception, ['""'])
assert result["order"] == ["123-1234567-1234567"] * 13
assert result["count"] == 13
assert result["order"] == ["123-1234567-1234567"] * 14
assert result["count"] == 14

result = amazon_exception(mock_imap_amazon_exception, ["[email protected]"])
assert result["count"] == 14
assert result["count"] == 15
assert (
"Amazon domains to be checked: ['amazon.com', 'amazon.ca', 'amazon.co.uk', 'amazon.in', 'amazon.de', 'amazon.it', 'amazon.com.au', 'amazon.pl', 'amazon.es', 'amazon.fr', 'amazon.ae', '[email protected]', '[email protected]', '[email protected]']"
"Amazon domains to be checked: ['amazon.com', 'amazon.ca', 'amazon.co.uk', 'amazon.in', 'amazon.de', 'amazon.it', 'amazon.com.au', 'amazon.pl', 'amazon.es', 'amazon.fr', 'amazon.ae', 'amazon.nl', '[email protected]', '[email protected]', '[email protected]']"
in caplog.text
)

Expand Down

0 comments on commit 0a4a180

Please sign in to comment.