Remove try/except + test

Changes in d064ff5 made try/except unnecessary and the subsequent test failed.
This commit is contained in:
Clemens Rieder 2023-01-12 09:36:55 +01:00 committed by Trenton H
parent dee691b72b
commit 959f80604a
2 changed files with 6 additions and 16 deletions

View File

@ -92,18 +92,13 @@ class TagMailAction(BaseMailAction):
# The custom tag should look like "apple:<color>" # The custom tag should look like "apple:<color>"
if "apple:" in parameter.lower(): if "apple:" in parameter.lower():
try:
_, self.color = parameter.split(":")
self.color = self.color.strip()
if not self.color.lower() in APPLE_MAIL_TAG_COLORS.keys(): _, self.color = parameter.split(":")
raise MailError("Not a valid AppleMail tag color.") self.color = self.color.strip()
except Exception as e:
raise MailError( if not self.color.lower() in APPLE_MAIL_TAG_COLORS.keys():
"""Could not parse parameters. raise MailError("Not a valid AppleMail tag color.")
Make sure they look like this: apple:<color> and
only use allowed colors.""",
) from e
self.keyword = None self.keyword = None
else: else:

View File

@ -682,11 +682,6 @@ class TestMail(DirectoriesMixin, TestCase):
TagMailAction, TagMailAction,
"apple:black", "apple:black",
) )
self.assertRaises(
MailError,
TagMailAction,
"applegreen",
)
def test_handle_mail_account_tag_applemail(self): def test_handle_mail_account_tag_applemail(self):
# all mails will be FLAGGED afterwards # all mails will be FLAGGED afterwards