Beispiel #1
0
 def setUpTestData(cls):
     cls.addon1 = addon_factory(guid='@guid1')
     cls.addon2 = addon_factory(guid='@guid2')
     cls.addon3 = addon_factory(guid='@guid3')
     cls.user = user_factory()
     grant_permission(cls.user, 'Admin:Tools', 'Admin Group')
     grant_permission(cls.user, 'AbuseReports:Edit', 'Abuse Report Triage')
     # Create a few abuse reports.
     AbuseReport.objects.create(
         addon=cls.addon1, guid='@guid1', message='Foo',
         state=AbuseReport.STATES.VALID,
         created=days_ago(98))
     AbuseReport.objects.create(
         addon=cls.addon2, guid='@guid2', message='Bar',
         state=AbuseReport.STATES.VALID)
     AbuseReport.objects.create(
         addon=cls.addon3, guid='@guid3', message='Soap',
         reason=AbuseReport.REASONS.OTHER,
         created=days_ago(100))
     AbuseReport.objects.create(
         addon=cls.addon1, guid='@guid1', message='',
         reporter=user_factory())
     # This is a report for an addon not in the database.
     AbuseReport.objects.create(
         guid='@unknown_guid', addon_name='Mysterious Addon', message='Doo')
     # This is one against a user.
     AbuseReport.objects.create(
         user=user_factory(), message='Eheheheh')
Beispiel #2
0
 def setUpTestData(cls):
     cls.addon1 = addon_factory(guid='@guid1', name='Neo')
     cls.addon2 = addon_factory(guid='@guid2', name='Two')
     cls.addon3 = addon_factory(guid='@guid3', name='Three')
     cls.user = user_factory()
     grant_permission(cls.user, 'Admin:Tools', 'Admin Group')
     grant_permission(cls.user, 'AbuseReports:Edit', 'Abuse Report Triage')
     # Create a few abuse reports.
     AbuseReport.objects.create(addon=cls.addon1,
                                guid='@guid1',
                                message='Foo',
                                state=AbuseReport.STATES.VALID,
                                created=days_ago(98))
     AbuseReport.objects.create(addon=cls.addon2,
                                guid='@guid2',
                                message='Bar',
                                state=AbuseReport.STATES.VALID)
     AbuseReport.objects.create(addon=cls.addon3,
                                guid='@guid3',
                                message='Soap',
                                reason=AbuseReport.REASONS.OTHER,
                                created=days_ago(100))
     AbuseReport.objects.create(addon=cls.addon1,
                                guid='@guid1',
                                message='',
                                reporter=user_factory())
     # This is a report for an addon not in the database.
     AbuseReport.objects.create(guid='@unknown_guid',
                                addon_name='Mysterious Addon',
                                message='Doo')
     # This is one against a user.
     AbuseReport.objects.create(
         user=user_factory(username='******'), message='Ehehehehe')
def test_pending_activity_log_count_for_developer(
        action1, action2, action3, count):
    user = user_factory()
    addon = addon_factory()
    version = addon.latest_version
    amo.log(action1, addon, version, user=user, created=days_ago(2))
    amo.log(action2, addon, version, user=user, created=days_ago(1))
    amo.log(action3, addon, version, user=user, created=days_ago(0))

    assert helpers.pending_activity_log_count_for_developer(version) == count
Beispiel #4
0
def test_pending_activity_log_count_for_developer(
        action1, action2, action3, count):
    user = user_factory()
    addon = addon_factory()
    version = addon.current_version
    amo.log(action1, addon, version, user=user, created=days_ago(2))
    amo.log(action2, addon, version, user=user, created=days_ago(1))
    amo.log(action3, addon, version, user=user, created=days_ago(0))

    assert helpers.pending_activity_log_count_for_developer(version) == count
Beispiel #5
0
    def test_expiry_update(self):
        """Test expiry is updated when reviewer reloads his queue."""
        self.theme_factory()
        reviewer = self.create_and_become_reviewer()
        self.get_themes(reviewer)

        ThemeLock.objects.filter(reviewer=reviewer).update(expiry=days_ago(1))
        _get_themes(mock.Mock(), reviewer, flagged=self.flagged)
        self.get_themes(reviewer)
        assert ThemeLock.objects.filter(
            reviewer=reviewer)[0].expiry > days_ago(1)
Beispiel #6
0
    def test_expiry_update(self):
        """Test expiry is updated when reviewer reloads his queue."""
        self.theme_factory()
        reviewer = self.create_and_become_reviewer()
        self.get_themes(reviewer)

        ThemeLock.objects.filter(reviewer=reviewer).update(expiry=days_ago(1))
        _get_themes(mock.Mock(), reviewer, flagged=self.flagged)
        self.get_themes(reviewer)
        assert ThemeLock.objects.filter(
            reviewer=reviewer)[0].expiry > days_ago(1)
def test_pending_activity_log_count_for_developer(action1, action2, action3,
                                                  count):
    user = user_factory()
    addon = addon_factory()
    version = addon.current_version
    ActivityLog.create(action1, addon, version,
                       user=user).update(created=days_ago(2))
    ActivityLog.create(action2, addon, version,
                       user=user).update(created=days_ago(1))
    ActivityLog.create(action3, addon, version,
                       user=user).update(created=days_ago(0))

    assert helpers.pending_activity_log_count_for_developer(version) == count
Beispiel #8
0
def test_pending_activity_log_count_for_developer(
        action1, action2, action3, expected_count):
    user = user_factory()
    addon = addon_factory()
    version = addon.current_version
    ActivityLog.create(action1, addon, version, user=user).update(
        created=days_ago(2))
    ActivityLog.create(action2, addon, version, user=user).update(
        created=days_ago(1))
    ActivityLog.create(action3, addon, version, user=user).update(
        created=days_ago(0))

    count = jinja_helpers.pending_activity_log_count_for_developer(version)
    assert count == expected_count
Beispiel #9
0
 def setUpTestData(cls):
     cls.addon1 = addon_factory(guid='@guid1', name='Neo')
     cls.addon1.name.__class__.objects.create(id=cls.addon1.name_id,
                                              locale='fr',
                                              localized_string='Elu')
     cls.addon2 = addon_factory(guid='@guid2', name='Two')
     cls.addon3 = addon_factory(guid='@guid3', name='Three')
     cls.user = user_factory(email='*****@*****.**')
     grant_permission(cls.user, 'AbuseReports:Edit', 'Abuse Report Triage')
     # Create a few abuse reports.
     cls.report1 = AbuseReport.objects.create(
         addon=cls.addon1,
         guid='@guid1',
         message='Foo',
         state=AbuseReport.STATES.VALID,
         created=days_ago(98),
     )
     AbuseReport.objects.create(
         addon=cls.addon2,
         guid='@guid2',
         message='Bar',
         state=AbuseReport.STATES.VALID,
     )
     AbuseReport.objects.create(
         addon=cls.addon3,
         guid='@guid3',
         message='Soap',
         reason=AbuseReport.REASONS.OTHER,
         created=days_ago(100),
     )
     AbuseReport.objects.create(
         addon=cls.addon1,
         guid='@guid1',
         message='With Addon',
         reporter=user_factory(),
     )
     # This one is against addon1 but without a FK, just the guid.
     AbuseReport.objects.create(guid='@guid1',
                                message='',
                                reporter=user_factory())
     # This is a report for an addon not in the database.
     cls.report2 = AbuseReport.objects.create(guid='@unknown_guid',
                                              addon_name='Mysterious Addon',
                                              message='Doo')
     # This is one against a user.
     cls.report3 = AbuseReport.objects.create(
         user=user_factory(username='******'), message='Ehehehehe')
 def setUp(self):
     self.now = days_ago(0)
     self.user_kwargs.update({
         'email': u'[email protected]',
         'display_name': u'This is my náme',
         'last_login_ip': '123.45.67.89',
     })
     super(TestUserProfileSerializer, self).setUp()
 def setUp(self):
     self.now = days_ago(0)
     self.user_kwargs.update({
         'email': u'[email protected]',
         'display_name': u'This is my náme',
         'last_login_ip': '123.45.67.89',
     })
     super(TestUserProfileSerializer, self).setUp()
 def setUp(self):
     self.now = days_ago(0)
     self.user_email = '[email protected]'
     self.user_kwargs.update({
         'email': self.user_email,
         'display_name': 'This is my náme',
         'last_login_ip': '123.45.67.89',
     })
     super().setUp()