This commit is contained in:
Andy McKay 2012-04-25 18:29:34 -07:00
Родитель e789347fdb
Коммит 8be4b7d86d
2 изменённых файлов: 12 добавлений и 2 удалений

Просмотреть файл

@ -60,13 +60,12 @@ class CurrencyError(PaypalError):
def __str__(self):
default = _('There was an error with this currency.')
if self.paypal_data:
if self.paypal_data and 'currencyCode' in self.paypal_data:
return (messages.get(self.id) %
amo.PAYPAL_CURRENCIES[self.paypal_data['currencyCode']])
return default
errors = {'520003': AuthError}
# See http://bit.ly/vWV525 for information on these values.
# Note that if you have and invalid preapproval key you get 580022, but this

Просмотреть файл

@ -95,6 +95,17 @@ class TestPayKey(amo.tests.TestCase):
else:
raise ValueError('No PaypalError was raised')
@mock.patch('urllib2.OpenerDirector.open')
def test_error_no_currency(self, opener):
opener.return_value = StringIO(other_error.replace('520001', '559044'))
try:
data = self.data.copy()
paypal.get_paykey(data)
except paypal.PaypalError as error:
eq_(error.id, '559044')
else:
raise ValueError('No PaypalError was raised')
@mock.patch('urllib2.OpenerDirector.open')
def test_other_fails(self, opener):
opener.return_value = StringIO(other_error)