Detect intents where user linked to feature edit page. (#1895)
* Detect intents where user linked to feature edit page. * corrected URL path
This commit is contained in:
Родитель
917c24b74d
Коммит
c9c985f70e
|
@ -76,10 +76,12 @@ def detect_field(subject):
|
|||
|
||||
CHROMESTATUS_LINK_GENERATED_RE = re.compile(
|
||||
r'entry on the Chrome Platform Status:?\s+'
|
||||
r'[> ]*https?://(www\.)?chromestatus\.com/feature/(?P<id>\d+)', re.I)
|
||||
r'[> ]*https?://(www\.)?chromestatus\.com/'
|
||||
r'(feature|guide/edit)/(?P<id>\d+)', re.I)
|
||||
CHROMESTATUS_LINK_ALTERNATE_RE = re.compile(
|
||||
r'entry on the feature dashboard.*\s+'
|
||||
r'[> ]*https?://(www\.)?chromestatus\.com/feature/(?P<id>\d+)', re.I)
|
||||
r'[> ]*https?://(www\.)?chromestatus\.com/'
|
||||
r'(feature|guide/edit)/(?P<id>\d+)', re.I)
|
||||
NOT_LGTM_RE = re.compile(
|
||||
r'\b(not|almost|need|want|missing) (a |an )?LGTM\b',
|
||||
re.I)
|
||||
|
|
|
@ -128,6 +128,17 @@ class FunctionTest(testing_config.CustomTestCase):
|
|||
5144822362931200,
|
||||
detect_intent.detect_feature_id(body))
|
||||
|
||||
def test_detect_feature_id__generated_edit(self):
|
||||
"""We can parse the feature ID from a link in the generated body."""
|
||||
body = (
|
||||
'blah blah blah\n'
|
||||
'Link to entry on the Chrome Platform Status\n'
|
||||
'https://www.chromestatus.com/guide/edit/5144822362931200\n'
|
||||
'blah blah blah')
|
||||
self.assertEqual(
|
||||
5144822362931200,
|
||||
detect_intent.detect_feature_id(body))
|
||||
|
||||
def test_detect_feature_id__generated_no_www(self):
|
||||
"""We can parse the feature ID from a link in the generated body."""
|
||||
body = (
|
||||
|
@ -150,6 +161,17 @@ class FunctionTest(testing_config.CustomTestCase):
|
|||
5144822362931200,
|
||||
detect_intent.detect_feature_id(body))
|
||||
|
||||
def test_detect_feature_id__alternative_edit(self):
|
||||
"""We can parse the feature ID from another common link."""
|
||||
body = (
|
||||
'blah blah blah\n'
|
||||
'Entry on the feature dashboard\n'
|
||||
'https://www.chromestatus.com/guide/edit/5144822362931200\n'
|
||||
'blah blah blah')
|
||||
self.assertEqual(
|
||||
5144822362931200,
|
||||
detect_intent.detect_feature_id(body))
|
||||
|
||||
def test_detect_feature_id__alternative_no_www(self):
|
||||
"""We can parse the feature ID from another common link."""
|
||||
body = (
|
||||
|
|
Загрузка…
Ссылка в новой задаче