예제 #1
0
 def test_disabled(self):
     pks = check_paypal_multiple(self.pks, limit=0)
     check_paypal(pks, self.get_check(False))
     addon = Addon.objects.get(pk=self.addon.pk)
     eq_(addon.status, amo.STATUS_DISABLED)
     eq_(ActivityLog.objects.for_addons(addon)
                    .filter(action=amo.LOG.PAYPAL_FAILED.id).count(), 1)
예제 #2
0
 def test_disabled(self):
     pks = check_paypal_multiple(self.pks, limit=0)
     check_paypal(pks, self.get_check(False))
     addon = Addon.objects.get(pk=self.addon.pk)
     eq_(addon.status, amo.STATUS_DISABLED)
     eq_(ActivityLog.objects.for_addons(addon)
                    .filter(action=amo.LOG.PAYPAL_FAILED.id).count(), 1)
예제 #3
0
    def test_waffle(self):
        # Ensure that turning off the waffle flag, actually does something.
        switch = Switch.objects.get(name='paypal-disable')
        switch.active = 0
        switch.save()

        pks = check_paypal_multiple(self.pks, limit=0)
        check_paypal(pks, self.get_check(False))
        addon = Addon.objects.get(pk=self.addon.pk)
        eq_(addon.status, amo.STATUS_PUBLIC)
        eq_(len(mail.outbox), 1)
        eq_(mail.outbox[0].to, [settings.FLIGTAR])
예제 #4
0
    def test_waffle(self):
        # Ensure that turning off the waffle flag, actually does something.
        switch = Switch.objects.get(name='paypal-disable')
        switch.active = 0
        switch.save()

        pks = check_paypal_multiple(self.pks, limit=0)
        check_paypal(pks, self.get_check(False))
        addon = Addon.objects.get(pk=self.addon.pk)
        eq_(addon.status, amo.STATUS_PUBLIC)
        eq_(len(mail.outbox), 1)
        eq_(mail.outbox[0].to, [settings.FLIGTAR])
예제 #5
0
 def test_no_addon(self):
     pks = check_paypal_multiple([3516], limit=0)
     check_paypal(pks)
     eq_(PaypalCheckStatus.objects.count(), 0)
예제 #6
0
 def test_fail_with_error(self):
     pks = check_paypal_multiple(self.pks, limit=0)
     _mock = self.get_check(False, errors=['This is a test.'])
     check_paypal(pks, _mock)
     assert 'This is a test' in mail.outbox[0].body
예제 #7
0
 def test_error(self):
     pks = check_paypal_multiple(self.pks, limit=0)
     _mock = self.get_check(False)
     _mock.side_effect = ValueError
     check_paypal(pks, _mock)
     eq_(PaypalCheckStatus.objects.count(), 1)
예제 #8
0
 def test_fail_not_limit_app(self):
     self.addon.update(type=amo.ADDON_WEBAPP)
     pks = check_paypal_multiple(self.pks, limit=0)
     check_paypal(pks, self.get_check(False))
     assert 'app' in mail.outbox[0].body
예제 #9
0
 def test_fail_not_limit_addon(self):
     pks = check_paypal_multiple(self.pks, limit=0)
     check_paypal(pks, self.get_check(False))
     assert 'add-on' in mail.outbox[0].body
예제 #10
0
 def test_fail_not_limit(self):
     pks = check_paypal_multiple(self.pks, limit=0)
     check_paypal(pks, self.get_check(False))
     eq_(len(mail.outbox), 2)
     eq_(mail.outbox[0].to, [a.email for a in self.addon.authors.all()])
예제 #11
0
 def test_fail_not_limit(self):
     pks = check_paypal_multiple(self.pks, limit=0)
     check_paypal(pks, self.get_check(False))
     eq_(len(mail.outbox), 2)
     eq_(mail.outbox[0].to, [a.email for a in self.addon.authors.all()])
예제 #12
0
 def test_no_addon(self):
     pks = check_paypal_multiple([3516], limit=0)
     check_paypal(pks)
     eq_(PaypalCheckStatus.objects.count(), 0)
예제 #13
0
 def test_pass(self):
     pks = check_paypal_multiple(self.pks)
     check_paypal(pks, self.get_check(True))
     assert len(mail.outbox) == 0, len(mail.outbox)
예제 #14
0
 def test_at_end(self):
     pks = check_paypal_multiple(self.pks * 2)
     check_paypal(pks[:1])
     assert not _check_paypal_completed()
     check_paypal(pks[1:2])
     assert _check_paypal_completed()
예제 #15
0
 def test_pass(self):
     pks = check_paypal_multiple(self.pks)
     check_paypal(pks, self.get_check(True))
     assert len(mail.outbox) == 0, len(mail.outbox)
예제 #16
0
 def test_fail_with_error(self):
     pks = check_paypal_multiple(self.pks, limit=0)
     _mock = self.get_check(False, errors=['This is a test.'])
     check_paypal(pks, _mock)
     assert 'This is a test' in mail.outbox[0].body
예제 #17
0
 def test_fail_not_limit_addon(self):
     pks = check_paypal_multiple(self.pks, limit=0)
     check_paypal(pks, self.get_check(False))
     assert 'add-on' in mail.outbox[0].body
예제 #18
0
 def test_fail_not_limit_app(self):
     self.addon.update(type=amo.ADDON_WEBAPP)
     pks = check_paypal_multiple(self.pks, limit=0)
     check_paypal(pks, self.get_check(False))
     assert 'app' in mail.outbox[0].body
예제 #19
0
 def test_at_end(self):
     pks = check_paypal_multiple(self.pks * 2)
     check_paypal(pks[:1])
     assert not _check_paypal_completed()
     check_paypal(pks[1:2])
     assert _check_paypal_completed()
예제 #20
0
 def test_fail_limit(self):
     pks = check_paypal_multiple(self.pks)
     check_paypal(pks, self.get_check(False))
     assert 'error' in mail.outbox[0].subject, mail.outbox[0].subject
예제 #21
0
 def test_error(self):
     pks = check_paypal_multiple(self.pks, limit=0)
     _mock = self.get_check(False)
     _mock.side_effect = ValueError
     check_paypal(pks, _mock)
     eq_(PaypalCheckStatus.objects.count(), 1)
예제 #22
0
 def test_fail_limit(self):
     pks = check_paypal_multiple(self.pks)
     check_paypal(pks, self.get_check(False))
     assert 'error' in mail.outbox[0].subject, mail.outbox[0].subject