aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorGravatar kwzrd <[email protected]>2020-06-20 01:46:59 +0200
committerGravatar GitHub <[email protected]>2020-06-20 01:46:59 +0200
commite37041622aebc8fef75d83fcd8970dc527c056bc (patch)
tree1d94ccc3583a73565965043f3d29898575d85465 /tests
parentMerge pull request #1015 from python-discord/kwzrd/pipenv-html-script (diff)
parentMerge branch 'master' into bug/mod/bot-2a/webhook-clyde (diff)
Merge pull request #1009 from python-discord/bug/mod/bot-2a/webhook-clyde
Fix 400 when "clyde" is in any webhook username
Diffstat (limited to 'tests')
-rw-r--r--tests/bot/utils/test_messages.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/bot/utils/test_messages.py b/tests/bot/utils/test_messages.py
new file mode 100644
index 000000000..9c22c9751
--- /dev/null
+++ b/tests/bot/utils/test_messages.py
@@ -0,0 +1,27 @@
+import unittest
+
+from bot.utils import messages
+
+
+class TestMessages(unittest.TestCase):
+ """Tests for functions in the `bot.utils.messages` module."""
+
+ def test_sub_clyde(self):
+ """Uppercase E's and lowercase e's are substituted with their cyrillic counterparts."""
+ sub_e = "\u0435"
+ sub_E = "\u0415" # noqa: N806: Uppercase E in variable name
+
+ test_cases = (
+ (None, None),
+ ("", ""),
+ ("clyde", f"clyd{sub_e}"),
+ ("CLYDE", f"CLYD{sub_E}"),
+ ("cLyDe", f"cLyD{sub_e}"),
+ ("BIGclyde", f"BIGclyd{sub_e}"),
+ ("small clydeus the unholy", f"small clyd{sub_e}us the unholy"),
+ ("BIGCLYDE, babyclyde", f"BIGCLYD{sub_E}, babyclyd{sub_e}"),
+ )
+
+ for username_in, username_out in test_cases:
+ with self.subTest(input=username_in, expected_output=username_out):
+ self.assertEqual(messages.sub_clyde(username_in), username_out)