| |
@@ -25,6 +25,7 @@
|
| |
import pagure.lib.notify
|
| |
import pagure.lib.query
|
| |
import tests
|
| |
+ import munch
|
| |
|
| |
|
| |
class PagureLibNotifytests(tests.Modeltests):
|
| |
@@ -543,6 +544,31 @@
|
| |
"""
|
| |
self.assertEqual(email.as_string(), exp)
|
| |
|
| |
+ def test_notification_mention(self):
|
| |
+ g = munch.Munch()
|
| |
+ g.session = self.session
|
| |
+ with patch("flask.g", g):
|
| |
+
|
| |
+ def _check_mention(comment, exp):
|
| |
+ emails = set([])
|
| |
+ emails = pagure.lib.notify._add_mentioned_users(
|
| |
+ emails, comment
|
| |
+ )
|
| |
+
|
| |
+ self.assertEqual(emails, exp)
|
| |
+
|
| |
+ exp = set(["bar@pingou.com"])
|
| |
+ comment = "I think we should ask @pingou how to pronounce pagure"
|
| |
+ _check_mention(comment, exp)
|
| |
+
|
| |
+ exp = set([])
|
| |
+ comment = """Let me quote him:
|
| |
+ ~~~~
|
| |
+ @pingou> Pagure is pronounced 'pa-gure', not 'pagu-re'
|
| |
+ ~~~~
|
| |
+ """
|
| |
+ _check_mention(comment, exp)
|
| |
+
|
| |
|
| |
if __name__ == "__main__":
|
| |
unittest.main(verbosity=2)
|
| |
Pagure also support block quotes with 4 * ` ie:
Adding a test for that seems to fail :/