Skip to content

Commit

Permalink
feat(shipper): update intelcom, ups and amazon with canadian french s…
Browse files Browse the repository at this point in the history
…trings (#954)

* Extended consts (closes #842)

Basically redone #842 for the correct branch

- Add french strings to amazon + canadian french AMAZON_LANG
- Add french string to ups
- IntelCom section with french contents

* Put intelcom stuff in the correct spot

* revert spacing

* Update const.py

* add german amazon email

* Run const.py through pyrfecter.com

To hopefully fix the issue tox's linter has with this PR

* Fix one forgotten comma

linter helped me find that lol

* update tests

---------

Co-authored-by: Chris <1105672+firstof9@users.noreply.github.com>
  • Loading branch information
Bluscream and firstof9 authored Jul 18, 2024
1 parent ff62bd4 commit 26f0ac1
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 10 deletions.
24 changes: 18 additions & 6 deletions custom_components/mail_and_packages/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@
"Livré",
"Entregado:",
"Bezorgd:",
"Livraison : Votre",
]
AMAZON_SHIPMENT_TRACKING = [
"shipment-tracking",
Expand All @@ -110,10 +111,7 @@
"verzending-volgen",
"update-bestelling",
]
AMAZON_EMAIL = [
"order-update@",
"update-bestelling@",
]
AMAZON_EMAIL = ["order-update@", "update-bestelling@", "versandbestaetigung@"]
AMAZON_PACKAGES = "amazon_packages"
AMAZON_ORDER = "amazon_order"
AMAZON_DELIVERED = "amazon_delivered"
Expand All @@ -126,6 +124,7 @@
"thehub@amazon.com",
"order-update@amazon.com",
"amazonlockers@amazon.com",
"versandbestaetigung@amazon.de",
]
AMAZON_HUB_SUBJECT = "ready for pickup from Amazon Hub Locker"
AMAZON_HUB_SUBJECT_SEARCH = "(a package to pick up)(.*)(\\d{6})"
Expand All @@ -143,6 +142,7 @@
"A chegar:",
"Arrivée :",
"Verwachte bezorgdatum:",
"Votre date de livraison prévue est :",
]
AMAZON_TIME_PATTERN_END = [
"Previously expected:",
Expand Down Expand Up @@ -177,6 +177,8 @@
"pt_PT.UTF-8",
"pt_BR",
"pt_BR.UTF-8",
"fr_CA",
"fr_CA.UTF-8",
"",
]

Expand Down Expand Up @@ -224,6 +226,7 @@
"Your UPS Packages were delivered",
"Your UPS Parcel was delivered",
"Your UPS Parcels were delivered",
"Votre colis UPS a été livré",
],
},
"ups_delivering": {
Expand All @@ -233,6 +236,8 @@
"UPS Update: Follow Your Delivery on a Live Map",
"UPS Pre-Arrival: Your Driver is Arriving Soon! Follow on a Live Map",
"UPS Update: Parcel Scheduled for Delivery Today",
"Mise à jour UPS : Livraison du colis prévue demain",
"Mise à jour UPS : Livraison du colis prévue aujourd'hui",
],
},
"ups_exception": {
Expand Down Expand Up @@ -563,11 +568,18 @@
# Intelcom
"intelcom_delivered": {
"email": ["notifications@intelcom.ca"],
"subject": ["Your order has been delivered!"],
"subject": [
"Your order has been delivered!",
"Votre commande a été livrée!",
"Votre colis a été livré!",
],
},
"intelcom_delivering": {
"email": ["notifications@intelcom.ca"],
"subject": ["Your package is on the way!"],
"subject": [
"Your package is on the way!",
"Votre colis est en chemin!",
],
},
"intelcom_packages": {
"email": ["notifications@intelcom.ca"],
Expand Down
8 changes: 4 additions & 4 deletions tests/test_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -789,7 +789,7 @@ async def test_amazon_search_results(hass, mock_imap_amazon_shipped):
result = amazon_search(
mock_imap_amazon_shipped, "test/path", hass, "testfilename.jpg", "amazon.com"
)
assert result == 7
assert result == 8


@pytest.mark.asyncio
Expand All @@ -800,10 +800,10 @@ async def test_amazon_search_delivered(
mock_imap_amazon_delivered, "test/path", hass, "testfilename.jpg", "amazon.com"
)
assert (
"Amazon email search address: ['order-update@amazon.com', 'update-bestelling@amazon.com']"
"Amazon email search address: ['order-update@amazon.com', 'update-bestelling@amazon.com', 'versandbestaetigung@amazon.com']"
in caplog.text
)
assert result == 7
assert result == 8
assert mock_download_img.called


Expand All @@ -818,7 +818,7 @@ async def test_amazon_search_delivered_it(
"testfilename.jpg",
"amazon.it",
)
assert result == 7
assert result == 8


@pytest.mark.asyncio
Expand Down

0 comments on commit 26f0ac1

Please sign in to comment.