aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar MarkKoz <[email protected]>2020-05-25 21:09:04 -0700
committerGravatar MarkKoz <[email protected]>2020-05-25 21:09:04 -0700
commit300f8c093edea03855d94be179c64c328ec842ac (patch)
treeec684ae70331ea0d12df1daafc6fc06a8e206259
parentFix multiple match text for token regex (diff)
Use real token values for testing multiple matches in regex
-rw-r--r--tests/bot/cogs/test_token_remover.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/tests/bot/cogs/test_token_remover.py b/tests/bot/cogs/test_token_remover.py
index 2ecfae2bd..971bc93fc 100644
--- a/tests/bot/cogs/test_token_remover.py
+++ b/tests/bot/cogs/test_token_remover.py
@@ -171,12 +171,13 @@ class TokenRemoverTests(unittest.IsolatedAsyncioTestCase):
def test_regex_matches_multiple_valid(self):
"""Should support multiple matches in the middle of a string."""
- tokens = ["x.y.z", "a.b.c"]
- message = f"garbage {tokens[0]} hello {tokens[1]} world"
+ token_1 = "NDY3MjIzMjMwNjUwNzc3NjQx.XsyWGg.uFNEQPCc4ePwGh7egG8UicQssz8"
+ token_2 = "NDcyMjY1OTQzMDYyNDEzMzMy.XsyWMw.l8XPnDqb0lp-EiQ2g_0xVFT1pyc"
+ message = f"garbage {token_1} hello {token_2} world"
results = token_remover.TOKEN_RE.finditer(message)
results = [match[0] for match in results]
- self.assertCountEqual(tokens, results)
+ self.assertCountEqual((token_1, token_2), results)
@autospec(TokenRemover, "is_valid_user_id", "is_valid_timestamp")
def test_is_maybe_token_missing_part_returns_false(self, valid_user, valid_time):