Skip to content

Commit

Permalink
fix: adjust amazon forward config processing (#697)
Browse files Browse the repository at this point in the history
  • Loading branch information
firstof9 authored Jul 25, 2022
2 parents a49ee3e + 1e8abf5 commit f6c5050
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 6 deletions.
6 changes: 5 additions & 1 deletion custom_components/mail_and_packages/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,12 @@ async def _check_amazon_forwards(forwards: str) -> tuple:
if "," in forwards:
amazon_forwards_list = forwards.split(",")

# No forwards
elif forwards in ["", "(none)", ""]:
amazon_forwards_list = []

# If only one address append it to the list
elif forwards != "" or forwards:
elif forwards:
amazon_forwards_list.append(forwards)

if len(errors) == 0:
Expand Down
2 changes: 1 addition & 1 deletion custom_components/mail_and_packages/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
DEFAULT_GIF_DURATION = 5
DEFAULT_SCAN_INTERVAL = 5
DEFAULT_GIF_FILE_NAME = "mail_today.gif"
DEFAULT_AMAZON_FWDS = '""'
DEFAULT_AMAZON_FWDS = "(none)"
DEFAULT_ALLOW_EXTERNAL = False
DEFAULT_CUSTOM_IMG = False
DEFAULT_CUSTOM_IMG_FILE = "custom_components/mail_and_packages/images/mail_none.gif"
Expand Down
2 changes: 1 addition & 1 deletion custom_components/mail_and_packages/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -1186,7 +1186,7 @@ def amazon_hub(account: Type[imaplib.IMAP4_SSL], fwds: Optional[str] = None) ->


def amazon_exception(
account: Type[imaplib.IMAP4_SSL], fwds: Optional[str] = None
account: Type[imaplib.IMAP4_SSL], fwds: Optional[list] = None
) -> dict:
"""Find Amazon exception emails.
Expand Down
2 changes: 1 addition & 1 deletion tests/test_config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -2030,7 +2030,7 @@ async def test_options_flow_mailbox_format2(
{
"allow_external": False,
"amazon_days": 3,
"amazon_fwds": ['""'],
"amazon_fwds": [],
"custom_img": False,
"host": "imap.test.email",
"port": 993,
Expand Down
4 changes: 2 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ ignore_basepython_conflict = True

[gh-actions]
python =
3.9: py39, lint, mypy
3.10: py310
3.9: py39
3.10: py310, lint, mypy

[testenv]
pip_version = pip>=21.0,<22.1
Expand Down

0 comments on commit f6c5050

Please sign in to comment.