コード例 #1
0
ファイル: test_tasks.py プロジェクト: kaiquewdev/zamboni
 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
ファイル: test_tasks.py プロジェクト: kaiquewdev/zamboni
    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
ファイル: test_tasks.py プロジェクト: kaiquewdev/zamboni
 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
ファイル: test_tasks.py プロジェクト: AALEKH/zamboni
 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
ファイル: test_tasks.py プロジェクト: kaiquewdev/zamboni
 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
ファイル: test_tasks.py プロジェクト: kaiquewdev/zamboni
 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
ファイル: test_tasks.py プロジェクト: kaiquewdev/zamboni
 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
ファイル: test_tasks.py プロジェクト: kaiquewdev/zamboni
 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
ファイル: test_tasks.py プロジェクト: kaiquewdev/zamboni
 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
ファイル: test_tasks.py プロジェクト: AALEKH/zamboni
 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
ファイル: test_tasks.py プロジェクト: kaiquewdev/zamboni
 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