Ejemplo n.º 1
0
 def test_refund_permissions_url(self, _call):
     """
     `paypal_refund_permission_url` returns an URL for PayPal's
     permissions request service containing the token PayPal gives
     us.
     """
     _call.return_value = {'token': 'foo'}
     assert 'foo' in paypal.refund_permission_url(self.addon)
Ejemplo n.º 2
0
 def _show_token_msg(self, message):
     """Display warning for an invalid PayPal refund token."""
     url = paypal.refund_permission_url(self.addon,
                                        self.extra.get('dest', 'payment'))
     msg = _(' <a href="%s">Visit PayPal to grant permission'
             ' for refunds on your behalf.</a>') % url
     messages.warning(self.request, '%s %s' % (message, Markup(msg)))
     raise forms.ValidationError(message)
Ejemplo n.º 3
0
 def test_refund_permissions_url(self, _call):
     """
     `paypal_refund_permission_url` returns an URL for PayPal's
     permissions request service containing the token PayPal gives
     us.
     """
     _call.return_value = {'token': 'foo'}
     assert 'foo' in paypal.refund_permission_url(self.addon)
Ejemplo n.º 4
0
 def _show_token_msg(self, message):
     """Display warning for an invalid PayPal refund token."""
     url = paypal.refund_permission_url(self.addon,
                                        self.extra.get('dest', 'payment'))
     msg = _(' <a href="%s">Visit PayPal to grant permission'
             ' for refunds on your behalf.</a>') % url
     messages.warning(self.request, '%s %s' % (message, Markup(msg)))
     raise forms.ValidationError(message)
Ejemplo n.º 5
0
 def test_refund_permissions_url(self, _call):
     """
     `paypal_refund_permission_url` returns an URL for PayPal's
     permissions request service containing the token PayPal gives
     us.
     """
     _call.return_value = {'token': 'foo'}
     addon = Addon(type=amo.ADDON_EXTENSION, slug='foo')
     assert 'foo' in paypal.refund_permission_url(addon)
Ejemplo n.º 6
0
 def test_refund_permissions_url(self, _call):
     """
     `paypal_refund_permission_url` returns an URL for PayPal's
     permissions request service containing the token PayPal gives
     us.
     """
     _call.return_value = {'token': 'foo'}
     addon = Addon(type=amo.ADDON_EXTENSION, slug='foo')
     assert 'foo' in paypal.refund_permission_url(addon)
Ejemplo n.º 7
0
 def test_refund_permissions_url_error(self, _call):
     _call.side_effect = paypal.PaypalError
     with self.assertRaises(paypal.PaypalError):
         paypal.refund_permission_url(self.addon)
Ejemplo n.º 8
0
 def test_refund_permissions_url_malformed(self, _call):
     _call.side_effect = paypal.PaypalError('580028')
     assert 'wont-work' in paypal.refund_permission_url(self.addon)
Ejemplo n.º 9
0
 def test_refund_permissions_url_settings(self, _call):
     settings.PAYPAL_PERMISSIONS_URL = ''
     assert not paypal.refund_permission_url(self.addon)
Ejemplo n.º 10
0
 def test_refund_permissions_url_error(self, _call):
     _call.side_effect = paypal.PaypalError
     with self.assertRaises(paypal.PaypalError):
         paypal.refund_permission_url(self.addon)
Ejemplo n.º 11
0
 def test_refund_permissions_url_malformed(self, _call):
     _call.side_effect = paypal.PaypalError('580028')
     assert 'wont-work' in paypal.refund_permission_url(self.addon)
Ejemplo n.º 12
0
 def test_refund_permissions_url_settings(self, _call):
     settings.PAYPAL_PERMISSIONS_URL = ''
     assert not paypal.refund_permission_url(self.addon)