diff options
Diffstat (limited to '')
| -rw-r--r-- | tests/bot/cogs/moderation/test_utils.py | 35 | 
1 files changed, 27 insertions, 8 deletions
| diff --git a/tests/bot/cogs/moderation/test_utils.py b/tests/bot/cogs/moderation/test_utils.py index 596f077b5..363d8938a 100644 --- a/tests/bot/cogs/moderation/test_utils.py +++ b/tests/bot/cogs/moderation/test_utils.py @@ -1,3 +1,4 @@ +import textwrap  import unittest  from datetime import datetime  from unittest.mock import AsyncMock, MagicMock, call, patch @@ -71,11 +72,11 @@ class ModerationUtilsTests(unittest.IsolatedAsyncioTestCase):                  "args": (self.user, "ban", "2020-02-26 09:20 (23 hours and 59 minutes)"),                  "expected_output": Embed(                      title=utils.INFRACTION_TITLE, -                    description=utils.INFRACTION_DESCRIPTION_TEMPLATE.format( +                    description=textwrap.shorten(utils.INFRACTION_DESCRIPTION_TEMPLATE.format(                          type="Ban",                          expires="2020-02-26 09:20 (23 hours and 59 minutes)",                          reason="No reason provided." -                    ), +                    ), width=2048, placeholder="..."),                      colour=Colours.soft_red,                      url=utils.RULES_URL                  ).set_author( @@ -89,11 +90,11 @@ class ModerationUtilsTests(unittest.IsolatedAsyncioTestCase):                  "args": (self.user, "warning", None, "Test reason."),                  "expected_output": Embed(                      title=utils.INFRACTION_TITLE, -                    description=utils.INFRACTION_DESCRIPTION_TEMPLATE.format( +                    description=textwrap.shorten(utils.INFRACTION_DESCRIPTION_TEMPLATE.format(                          type="Warning",                          expires="N/A",                          reason="Test reason." -                    ), +                    ), width=2048, placeholder="..."),                      colour=Colours.soft_red,                      url=utils.RULES_URL                  ).set_author( @@ -107,11 +108,11 @@ class ModerationUtilsTests(unittest.IsolatedAsyncioTestCase):                  "args": (self.user, "note", None, None, Icons.defcon_denied),                  "expected_output": Embed(                      title=utils.INFRACTION_TITLE, -                    description=utils.INFRACTION_DESCRIPTION_TEMPLATE.format( +                    description=textwrap.shorten(utils.INFRACTION_DESCRIPTION_TEMPLATE.format(                          type="Note",                          expires="N/A",                          reason="No reason provided." -                    ), +                    ), width=2048, placeholder="..."),                      colour=Colours.soft_red,                      url=utils.RULES_URL                  ).set_author( @@ -125,11 +126,11 @@ class ModerationUtilsTests(unittest.IsolatedAsyncioTestCase):                  "args": (self.user, "mute", "2020-02-26 09:20 (23 hours and 59 minutes)", "Test", Icons.defcon_denied),                  "expected_output": Embed(                      title=utils.INFRACTION_TITLE, -                    description=utils.INFRACTION_DESCRIPTION_TEMPLATE.format( +                    description=textwrap.shorten(utils.INFRACTION_DESCRIPTION_TEMPLATE.format(                          type="Mute",                          expires="2020-02-26 09:20 (23 hours and 59 minutes)",                          reason="Test" -                    ), +                    ), width=2048, placeholder="..."),                      colour=Colours.soft_red,                      url=utils.RULES_URL                  ).set_author( @@ -138,6 +139,24 @@ class ModerationUtilsTests(unittest.IsolatedAsyncioTestCase):                      icon_url=Icons.defcon_denied                  ).set_footer(text=utils.INFRACTION_APPEAL_FOOTER),                  "send_result": False +            }, +            { +                "args": (self.user, "mute", None, "foo bar" * 4000, Icons.defcon_denied), +                "expected_output": Embed( +                    title=utils.INFRACTION_TITLE, +                    description=textwrap.shorten(utils.INFRACTION_DESCRIPTION_TEMPLATE.format( +                        type="Mute", +                        expires="N/A", +                        reason="foo bar" * 4000 +                    ), width=2048, placeholder="..."), +                    colour=Colours.soft_red, +                    url=utils.RULES_URL +                ).set_author( +                    name=utils.INFRACTION_AUTHOR_NAME, +                    url=utils.RULES_URL, +                    icon_url=Icons.defcon_denied +                ).set_footer(text=utils.INFRACTION_APPEAL_FOOTER), +                "send_result": True              }          ] | 
