Пример #1
0
    def test_older_refund_escalations_then_new(self):
        stamp = datetime.datetime.now() - datetime.timedelta(days=2)
        self._purchase(self.user1, stamp)
        self._purchase(self.user2, stamp)

        # Triggers 33% for refund / purchase ratio.
        self._refund(self.user1, stamp)

        # Simulate a reviewer clearing an escalation...
        #   remove app from queue and write a log.
        EscalationQueue.objects.filter(addon=self.app).delete()
        amo.log(amo.LOG.ESCALATION_CLEARED,
                self.app,
                self.app.current_version,
                details={'comments': 'All ok'})
        eq_(EscalationQueue.objects.filter(addon=self.app).count(), 0)

        # Task will find it again but not add it again.
        find_refund_escalations(self.app.id)
        eq_(EscalationQueue.objects.filter(addon=self.app).count(), 0)

        # Issue another refund, which should trigger another escalation.
        self._purchase(self.user3)
        self._refund(self.user3)
        eq_(EscalationQueue.objects.filter(addon=self.app).count(), 1)
Пример #2
0
 def test_refunds_already_escalated(self):
     self._purchase(self.user1)
     self._purchase(self.user2)
     self._refund(self.user1)
     eq_(EscalationQueue.objects.filter(addon=self.app).count(), 1)
     # Task was run on Refund.post_save, re-run task to make sure we don't
     # escalate again.
     find_refund_escalations(self.app.id)
     eq_(EscalationQueue.objects.filter(addon=self.app).count(), 1)
Пример #3
0
 def test_refunds_already_escalated(self):
     self._purchase(self.user1)
     self._purchase(self.user2)
     self._refund(self.user1)
     eq_(EscalationQueue.objects.filter(addon=self.app).count(), 1)
     # Task was run on Refund.post_save, re-run task to make sure we don't
     # escalate again.
     find_refund_escalations(self.app.id)
     eq_(EscalationQueue.objects.filter(addon=self.app).count(), 1)
Пример #4
0
    def test_refunds_cleared_not_escalated(self):
        stamp = datetime.datetime.now() - datetime.timedelta(days=2)
        self._purchase(self.user1, stamp)
        self._purchase(self.user2, stamp)
        self._refund(self.user1, stamp)

        # Simulate a reviewer clearing an escalation...
        #   remove app from queue and write a log.
        EscalationQueue.objects.filter(addon=self.app).delete()
        amo.log(amo.LOG.ESCALATION_CLEARED, self.app, self.app.current_version, details={"comments": "All clear"})
        eq_(EscalationQueue.objects.filter(addon=self.app).count(), 0)
        # Task will find it again but not add it again.
        find_refund_escalations(self.app.id)
        eq_(EscalationQueue.objects.filter(addon=self.app).count(), 0)
Пример #5
0
    def test_refunds_cleared_not_escalated(self):
        stamp = datetime.datetime.now() - datetime.timedelta(days=2)
        self._purchase(self.user1, stamp)
        self._purchase(self.user2, stamp)
        self._refund(self.user1, stamp)

        # Simulate a reviewer clearing an escalation...
        #   remove app from queue and write a log.
        EscalationQueue.objects.filter(addon=self.app).delete()
        amo.log(amo.LOG.ESCALATION_CLEARED, self.app, self.app.current_version,
                details={'comments': 'All clear'})
        eq_(EscalationQueue.objects.filter(addon=self.app).count(), 0)
        # Task will find it again but not add it again.
        find_refund_escalations(self.app.id)
        eq_(EscalationQueue.objects.filter(addon=self.app).count(), 0)
Пример #6
0
    def test_older_refund_escalations_then_new(self):
        stamp = datetime.datetime.now() - datetime.timedelta(days=2)
        self._purchase(self.user1, stamp)
        self._purchase(self.user2, stamp)

        # Triggers 33% for refund / purchase ratio.
        self._refund(self.user1, stamp)

        # Simulate a reviewer clearing an escalation...
        #   remove app from queue and write a log.
        EscalationQueue.objects.filter(addon=self.app).delete()
        amo.log(amo.LOG.ESCALATION_CLEARED, self.app, self.app.current_version, details={"comments": "All ok"})
        eq_(EscalationQueue.objects.filter(addon=self.app).count(), 0)

        # Task will find it again but not add it again.
        find_refund_escalations(self.app.id)
        eq_(EscalationQueue.objects.filter(addon=self.app).count(), 0)

        # Issue another refund, which should trigger another escalation.
        self._purchase(self.user3)
        self._refund(self.user3)
        eq_(EscalationQueue.objects.filter(addon=self.app).count(), 1)
Пример #7
0
 def post_save(sender, instance, **kwargs):
     from amo.tasks import find_refund_escalations
     find_refund_escalations(instance.contribution.addon_id)
Пример #8
0
 def test_no_refunds(self):
     find_refund_escalations(self.app.id)
     eq_(EscalationQueue.objects.filter(addon=self.app).count(), 0)
Пример #9
0
 def test_no_refunds(self):
     find_refund_escalations(self.app.id)
     eq_(EscalationQueue.objects.filter(addon=self.app).count(), 0)
Пример #10
0
 def post_save(sender, instance, **kwargs):
     from amo.tasks import find_refund_escalations
     find_refund_escalations(instance.contribution.addon_id)