Ejemplo n.º 1
0
 def _extract_mentions(self, s):
     user_objects = []
     for username in extract_mentioned_users(s):
         user_obj = User.get_by_username(username, case_insensitive=True)
         if user_obj:
             user_objects.append(user_obj)
     return user_objects
Ejemplo n.º 2
0
 def _extract_mentions(self, s):
     user_objects = []
     for username in extract_mentioned_users(s):
         user_obj = User.get_by_username(username, case_insensitive=True)
         if user_obj:
             user_objects.append(user_obj)
     return user_objects
Ejemplo n.º 3
0
    def test_mention_extractor(self):
        from rhodecode.lib.utils2 import extract_mentioned_users

        sample = (
            "@first hi there @marcink here's my email [email protected] "
            "@lukaszb check @one_more22 it pls @ ttwelve @D[] @one@two@three "
            "@MARCIN    @maRCiN @2one_more22 @john please see this http://org.pl "
            "@marian.user just do it @marco-polo and next extract @marco_polo "
            "user.dot  hej ! not-needed [email protected]"
        )

        s = sorted(
            [
                "first",
                "marcink",
                "lukaszb",
                "one_more22",
                "MARCIN",
                "maRCiN",
                "john",
                "marian.user",
                "marco-polo",
                "marco_polo",
            ],
            key=lambda k: k.lower(),
        )
        self.assertEqual(s, extract_mentioned_users(sample))
Ejemplo n.º 4
0
    def test_mention_extractor(self):
        from rhodecode.lib.utils2 import extract_mentioned_users
        sample = (
            "@first hi there @marcink here's my email [email protected] "
            "@lukaszb check @one_more22 it pls @ ttwelve @D[] @one@two@three "
            "@MARCIN    @maRCiN @2one_more22 @john please see this http://org.pl "
            "@marian.user just do it @marco-polo and next extract @marco_polo "
            "user.dot  hej ! not-needed [email protected]")

        s = sorted([
            'first', 'marcink', 'lukaszb', 'one_more22', 'MARCIN', 'maRCiN',
            'john', 'marian.user', 'marco-polo', 'marco_polo'
        ],
                   key=lambda k: k.lower())
        self.assertEqual(s, extract_mentioned_users(sample))