Skip to content

Commit

Permalink
Issue #2856 - Add 'engine-gecko' label for Mozilla browsers
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike Taylor committed Apr 29, 2019
1 parent f4299d8 commit 8931c5e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
14 changes: 11 additions & 3 deletions tests/unit/test_webhook.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@ def setUp(self):
**Tested Another Browser**: Yes
""" # noqa

self.issue_body6 = u"""
**URL**: https://www.not-a-mozilla-browser.com/
<!-- @browser: Safari 99.0 -->
"""

def tearDown(self):
"""Tear down tests."""
pass
Expand Down Expand Up @@ -209,10 +214,13 @@ def test_extract_priority_label(self):
def test_get_issue_labels(self):
"""Extract list of labels from an issue body."""
labels_tests = [
(self.issue_body, ['browser-firefox', 'type-media', 'type-stylo']),
(self.issue_body, ['browser-firefox', 'type-media', 'type-stylo',
'engine-gecko']),
(self.issue_body2, ['browser-fixme', 'type-foobar']),
(self.issue_body3, ['browser-firefox-tablet']),
(self.issue_body5, ['browser-firefox-reality', 'type-media']),
(self.issue_body3, ['browser-firefox-tablet', 'engine-gecko']),
(self.issue_body5, ['browser-firefox-reality', 'engine-gecko',
'type-media']),
(self.issue_body6, ['browser-safari']),
]
for issue_body, expected in labels_tests:
actual = helpers.get_issue_labels(issue_body)
Expand Down
10 changes: 10 additions & 0 deletions webcompat/webhooks/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@
from webcompat.helpers import proxy_request

BROWSERS = ['blackberry', 'brave', 'chrome', 'edge', 'firefox', 'iceweasel', 'ie', 'lynx', 'myie', 'opera', 'puffin', 'qq', 'safari', 'samsung', 'seamonkey', 'uc', 'vivaldi'] # noqa
MOZILLA_BROWSERS = ['browser-fenix',
'browser-firefox',
'browser-firefox-mobile',
'browser-firefox-reality',
'browser-firefox-tablet',
'browser-focus-geckoview',
'browser-geckoview',
]


def extract_metadata(body):
Expand Down Expand Up @@ -165,6 +173,8 @@ def get_issue_labels(issue_body):
labelslist.extend(extra_labels)
priority_label = extract_priority_label(issue_body)
labelslist.extend([browser_label, priority_label])
if any(label for label in labelslist if label in MOZILLA_BROWSERS):
labelslist.append('engine-gecko')
labelslist = [label for label in labelslist if label is not None]
return labelslist

Expand Down

0 comments on commit 8931c5e

Please sign in to comment.