Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: adjust amazon forward config processing #697

Merged
merged 1 commit into from
Jul 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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