Пример #1
0
    def test_verdict_info_prettifier(self):
        verdict_info = {
            'too_few_approved_updates': True,
            'too_many_average_daily_users': True,
            'uses_content_script_for_all_urls': True,
            'uses_custom_csp': True,
            'uses_native_messaging': True,
            'has_info_request': True,
            'is_locked': True,
            'is_under_admin_review': True,
        }
        result = list(
            AutoApprovalSummary.verdict_info_prettifier(verdict_info))
        assert result == [
            u'Has a pending info request.', u'Is locked by a reviewer.',
            u'Is flagged for admin review.',
            u'Has too few consecutive human-approved updates.',
            u'Has too many daily users.',
            u'Uses a content script for all URLs.', u'Uses a custom CSP.',
            u'Uses nativeMessaging permission.'
        ]

        verdict_info = {
            'too_few_approved_updates': True,
            'uses_content_script_for_all_urls': True,
            'uses_native_messaging': True
        }
        result = list(
            AutoApprovalSummary.verdict_info_prettifier(verdict_info))
        assert result == [
            u'Has too few consecutive human-approved updates.',
            u'Uses a content script for all URLs.',
            u'Uses nativeMessaging permission.'
        ]
Пример #2
0
 def test_verdict_info_pretty(self):
     summary = AutoApprovalSummary.objects.create(
         version=self.version,
         uses_custom_csp=True,
         uses_native_messaging=True,
         uses_content_script_for_all_urls=True,
         average_daily_users=self.addon.average_daily_users,
         approved_updates=333)
     expected_result = list(
         AutoApprovalSummary.verdict_info_prettifier({
             'too_few_approved_updates':
             True,
             'too_many_average_daily_users':
             True,
             'uses_content_script_for_all_urls':
             True,
             'uses_custom_csp':
             True,
             'uses_native_messaging':
             True
         }))
     result = list(
         summary.calculate_verdict(
             max_average_daily_users=summary.average_daily_users - 1,
             min_approved_updates=summary.approved_updates + 1,
             pretty=True))
     assert result == expected_result
     assert summary.verdict == amo.NOT_AUTO_APPROVED