Commit 4ecd3d6 Fix the RELATES regex as we fixed the FIXES ones

2 files Authored and Committed by pingou 2 months ago
Fix the RELATES regex as we fixed the FIXES ones

Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>

    
1 @@ -37,7 +37,7 @@
2       re.compile(r'(?:.*\s+)?relate[sd]?:?\s?#(\d+)', re.I),
3       re.compile(
4           r'(?:.*\s+)?relate[sd]?:?\s*?(?:to)?\s*?'
5 -         'https?://.*/(\w+)/issue/(\d+)', re.I),
6 +         'https?://.*/([a-zA-z0-9_][a-zA-Z0-9-_]*)/issue/(\d+)', re.I),
7   ]
8   
9   
 1 @@ -223,6 +223,13 @@
 2               else:
 3                   self.assertEqual(regex.match(text), None)
 4   
 5 +         text = 'relates https://localhost/SSSD/ding-libs/issue/31'
 6 +         for index, regex in enumerate(pagure.lib.link.RELATES):
 7 +             if index == 2:
 8 +                 self.assertNotEqual(regex.match(text), None)
 9 +             else:
10 +                 self.assertEqual(regex.match(text), None)
11 + 
12       def test_fixes_regex(self):
13           ''' Test the fixes regex present in pagure.lib.link. '''
14