-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(shipper): add amazon.com.au and update auspost_delivering (#625)
- Loading branch information
Showing
4 changed files
with
16 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -68,7 +68,9 @@ | |
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 +210,7 @@ | |
}, | ||
"auspost_delivering": { | ||
"email": ["[email protected]"], | ||
"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 "]}, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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, ["[email protected]"]) | ||
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', '[email protected]']" | ||
"Amazon domains to be checked: ['amazon.com', 'amazon.ca', 'amazon.co.uk', 'amazon.in', 'amazon.de', 'amazon.it', 'amazon.com.au', '[email protected]']" | ||
in caplog.text | ||
) | ||
|
||
|
@@ -1104,7 +1097,8 @@ async def test_email_search_none(mock_imap_search_error_none, caplog): | |
) | ||
assert result == ("OK", [b""]) | ||
|
||
async def test_amazon_shipped_fwd(hass, mock_imap_amazon_fwd,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 | ||
assert "Arrive Date: Tuesday, January 11" in caplog.text |