Adjust abuse API parameter constants to match what Firefox has

See https://bugzilla.mozilla.org/show_bug.cgi?id=1543377
This commit is contained in:
Mathieu Pillard 2019-04-26 13:05:50 +02:00
Родитель 253e50779e
Коммит 210b1bc7cd
5 изменённых файлов: 79 добавлений и 21 удалений

Просмотреть файл

@ -95,6 +95,13 @@ and should be truncated by the client where necessary.
management_webext_api WebExt Management API
drag_and_drop Drag & Drop
sideload Sideload
file_uri File URI
enterprise_policy Enterprise Policy
distribution Included in build
system_addon System Add-on
temporary_addon Temporary Add-on
sync Sync
other Other
=========================== =================================================
.. _abuse-addon_signature-parameter:
@ -110,6 +117,13 @@ and should be truncated by the client where necessary.
partner Partner
non_curated Non-curated
unsigned Unsigned
broken Broken
unknown Unknown
missing Missing
preliminary Preliminary
signed Signed
system System
privileged Privileged
=========================== =================================================
.. _abuse-reason-parameter:
@ -119,12 +133,12 @@ and should be truncated by the client where necessary.
=========================== ================================================================
Value Description
=========================== ================================================================
harmful Damages computer and/or data
spam_or_advertising Creates spam or advertising
browser_takeover Changes search / homepage / new tab page without informing user
damage Damages computer and/or data
spam Creates spam or advertising
settings Changes search / homepage / new tab page without informing user
broken Doesnt work, breaks websites, or slows Firefox down
offensive Hateful, violent, or illegal content
does_not_match_description Doesn't match description
policy Hateful, violent, or illegal content
deceptive Doesn't match description
unwanted Wasn't wanted / impossible to get rid of
other Something else
=========================== ================================================================

Просмотреть файл

@ -44,21 +44,29 @@ class AbuseReport(ModelBase):
('PARTNER', 3, 'Partner'),
('NON_CURATED', 4, 'Non-curated'),
('UNSIGNED', 5, 'Unsigned'),
('BROKEN', 6, 'Broken'),
('UNKNOWN', 7, 'Unknown'),
('MISSING', 8, 'Missing'),
('PRELIMINARY', 9, 'Preliminary'),
('SIGNED', 10, 'Signed'),
('SYSTEM', 11, 'System'),
('PRIVILEGED', 12, 'Privileged'),
)
REASONS = APIChoicesWithNone(
('HARMFUL', 1, 'Damages computer and/or data'),
('SPAM_OR_ADVERTISING', 2, 'Creates spam or advertising'),
('BROWSER_TAKEOVER', 3, 'Changes search / homepage / new tab page '
'without informing user'),
('DAMAGE', 1, 'Damages computer and/or data'),
('SPAM', 2, 'Creates spam or advertising'),
('SETTINGS', 3, 'Changes search / homepage / new tab page '
'without informing user'),
# `4` was previously 'New tab takeover' but has been merged into the
# previous one. We avoid re-using the value.
('BROKEN', 5, "Doesnt work, breaks websites, or slows Firefox down"),
('OFFENSIVE', 6, 'Hateful, violent, or illegal content'),
('DOES_NOT_MATCH_DESCRIPTION', 7, "Pretends to be something its not"),
('POLICY', 6, 'Hateful, violent, or illegal content'),
('DECEPTIVE', 7, "Pretends to be something its not"),
# `8` was previously "Doesn't work" but has been merged into the
# previous one. We avoid re-using the value.
('UNWANTED', 9, "Wasn't wanted / impossible to get rid of"),
('OTHER', 10, 'Other'),
# `10` was previously "Other". We avoid re-using the value.
('OTHER', 127, 'Other'),
)
ADDON_INSTALL_METHODS = APIChoicesWithNone(
@ -69,6 +77,13 @@ class AbuseReport(ModelBase):
('MANAGEMENT_WEBEXT_API', 5, 'Webext management API'),
('DRAG_AND_DROP', 6, 'Drag & Drop'),
('SIDELOAD', 7, 'Sideload'),
('FILE_URI', 8, 'File URI'),
('ENTERPRISE_POLICY', 9, 'Enterprise Policy'),
('DISTRIBUTION', 10, 'Included in build'),
('SYSTEM_ADDON', 11, 'System Add-on'),
('TEMPORARY_ADDON', 12, 'Temporary Add-on'),
('SYNC', 13, 'Sync'),
('OTHER', 127, 'Other'),
)
REPORT_ENTRY_POINTS = APIChoicesWithNone(
('UNINSTALL', 1, 'Uninstall'),

Просмотреть файл

@ -20,6 +20,13 @@ class TestAbuse(TestCase):
(3, 'Partner'),
(4, 'Non-curated'),
(5, 'Unsigned'),
(6, 'Broken'),
(7, 'Unknown'),
(8, 'Missing'),
(9, 'Preliminary'),
(10, 'Signed'),
(11, 'System'),
(12, 'Privileged'),
)
assert AbuseReport.ADDON_SIGNATURES.api_choices == (
(None, None),
@ -28,6 +35,13 @@ class TestAbuse(TestCase):
(3, 'partner'),
(4, 'non_curated'),
(5, 'unsigned'),
(6, 'broken'),
(7, 'unknown'),
(8, 'missing'),
(9, 'preliminary'),
(10, 'signed'),
(11, 'system'),
(12, 'privileged'),
)
assert AbuseReport.REASONS.choices == (
@ -40,18 +54,18 @@ class TestAbuse(TestCase):
(6, 'Hateful, violent, or illegal content'),
(7, "Pretends to be something its not"),
(9, "Wasn't wanted / impossible to get rid of"),
(10, 'Other'),
(127, 'Other'),
)
assert AbuseReport.REASONS.api_choices == (
(None, None),
(1, 'harmful'),
(2, 'spam_or_advertising'),
(3, 'browser_takeover'),
(1, 'damage'),
(2, 'spam'),
(3, 'settings'),
(5, 'broken'),
(6, 'offensive'),
(7, 'does_not_match_description'),
(6, 'policy'),
(7, 'deceptive'),
(9, 'unwanted'),
(10, 'other'),
(127, 'other'),
)
assert AbuseReport.ADDON_INSTALL_METHODS.choices == (
@ -63,7 +77,15 @@ class TestAbuse(TestCase):
(5, 'Webext management API'),
(6, 'Drag & Drop'),
(7, 'Sideload'),
(8, 'File URI'),
(9, 'Enterprise Policy'),
(10, 'Included in build'),
(11, 'System Add-on'),
(12, 'Temporary Add-on'),
(13, 'Sync'),
(127, 'Other')
)
assert AbuseReport.ADDON_INSTALL_METHODS.api_choices == (
(None, None),
(1, 'amwebapi'),
@ -73,6 +95,13 @@ class TestAbuse(TestCase):
(5, 'management_webext_api'),
(6, 'drag_and_drop'),
(7, 'sideload'),
(8, 'file_uri'),
(9, 'enterprise_policy'),
(10, 'distribution'),
(11, 'system_addon'),
(12, 'temporary_addon'),
(13, 'sync'),
(127, 'other')
)
assert AbuseReport.REPORT_ENTRY_POINTS.choices == (

Просмотреть файл

@ -196,7 +196,7 @@ class AddonAbuseViewSetTestBase(object):
'lang': u'Lô-käl',
'operating_system': u'Sømething OS',
'install_date': '2004-08-15T16:23:42',
'reason': 'spam_or_advertising',
'reason': 'spam',
'addon_install_origin': 'http://example.com/',
'addon_install_method': None,
'report_entry_point': None,

Просмотреть файл

@ -4177,7 +4177,7 @@ class TestReview(ReviewBase):
operating_system='Løst OS',
operating_system_version='20040922',
install_date=self.days_ago(1),
reason=AbuseReport.REASONS.OFFENSIVE,
reason=AbuseReport.REASONS.POLICY,
addon_install_origin='https://example.com/',
addon_install_method=AbuseReport.ADDON_INSTALL_METHODS.LINK,
report_entry_point=AbuseReport.REPORT_ENTRY_POINTS.MENU,