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