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)
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])
def test_no_addon(self): pks = check_paypal_multiple([3516], limit=0) check_paypal(pks) eq_(PaypalCheckStatus.objects.count(), 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
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)
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
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
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()])
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)
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()
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