You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by br...@apache.org on 2021/08/24 15:39:00 UTC

[allura] 02/02: added test to validate parsing of usernames with underscores

This is an automated email from the ASF dual-hosted git repository.

brondsem pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/allura.git

commit 2e90aef3af5cca9788ed2ac923824cbf83a949a2
Author: Guillermo Cruz <gu...@slashdotmedia.com>
AuthorDate: Mon Aug 23 19:14:07 2021 -0600

    added test to validate parsing of usernames with underscores
---
 Allura/allura/tests/test_globals.py | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/Allura/allura/tests/test_globals.py b/Allura/allura/tests/test_globals.py
index 71a7dc1..52f1cf8 100644
--- a/Allura/allura/tests/test_globals.py
+++ b/Allura/allura/tests/test_globals.py
@@ -878,6 +878,15 @@ class TestUserMentions(unittest.TestCase):
         assert '<div class="codehilite">' in output
         assert ('href="%s"' % u1.url()) not in output
 
+    @patch('allura.lib.widgets.forms.NeighborhoodProjectShortNameValidator')
+    def test_markdown_user_mention_underscores(self, NeighborhoodProjectShortNameValidator):
+        username = 'r_808__'
+        NeighborhoodProjectShortNameValidator.to_python.return_value = username
+        u1 = M.User.register(dict(username=username), make_project=True)
+        ThreadLocalORMSession.flush_all()
+        output = g.markdown.convert(f'Hello.. @{username}, how are you?')
+        assert 'class="user-mention"' in output
+
 
 class TestHandlePaging(unittest.TestCase):