From a31995648b2856a2b60c8960f871bcabc5d52e10 Mon Sep 17 00:00:00 2001 From: Mike Taylor Date: Mon, 29 Apr 2019 17:36:50 -0500 Subject: [PATCH] Issue #2856 - Add 'engine-gecko' label for Mozilla browsers --- tests/unit/test_webhook.py | 12 +++++++++--- webcompat/webhooks/helpers.py | 10 ++++++++++ 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/tests/unit/test_webhook.py b/tests/unit/test_webhook.py index eaa0509dd..0a58ae898 100644 --- a/tests/unit/test_webhook.py +++ b/tests/unit/test_webhook.py @@ -83,6 +83,11 @@ def setUp(self): **Tested Another Browser**: Yes """ # noqa + self.issue_body6 = u""" + **URL**: https://www.not-a-mozilla-browser.com/ + + """ + def tearDown(self): """Tear down tests.""" pass @@ -209,10 +214,11 @@ 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) diff --git a/webcompat/webhooks/helpers.py b/webcompat/webhooks/helpers.py index 3fc1077ac..bfbdd0e13 100644 --- a/webcompat/webhooks/helpers.py +++ b/webcompat/webhooks/helpers.py @@ -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): @@ -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