|
@ -226,18 +226,15 @@ class TestAccountBankAccountStatementImportOnlinePayPal( |
|
|
|
|
|
|
|
|
provider = journal.online_bank_statement_provider_id |
|
|
provider = journal.online_bank_statement_provider_id |
|
|
mocked_response = UrlopenRetValMock("""{ |
|
|
mocked_response = UrlopenRetValMock("""{ |
|
|
"message": "MSG", |
|
|
|
|
|
|
|
|
"message": "MESSAGE", |
|
|
"name": "ERROR" |
|
|
"name": "ERROR" |
|
|
}""", throw=True) |
|
|
}""", throw=True) |
|
|
with mock.patch( |
|
|
with mock.patch( |
|
|
_provider_class + '._paypal_urlopen', |
|
|
_provider_class + '._paypal_urlopen', |
|
|
return_value=mocked_response, |
|
|
return_value=mocked_response, |
|
|
), self.mock_token(): |
|
|
|
|
|
|
|
|
): |
|
|
with self.assertRaises(UserError): |
|
|
with self.assertRaises(UserError): |
|
|
provider._obtain_statement_data( |
|
|
|
|
|
self.now - relativedelta(years=5), |
|
|
|
|
|
self.now, |
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
provider._paypal_retrieve('https://url', '') |
|
|
|
|
|
|
|
|
def test_error_handling_2(self): |
|
|
def test_error_handling_2(self): |
|
|
journal = self.AccountJournal.create({ |
|
|
journal = self.AccountJournal.create({ |
|
@ -251,18 +248,15 @@ class TestAccountBankAccountStatementImportOnlinePayPal( |
|
|
|
|
|
|
|
|
provider = journal.online_bank_statement_provider_id |
|
|
provider = journal.online_bank_statement_provider_id |
|
|
mocked_response = UrlopenRetValMock("""{ |
|
|
mocked_response = UrlopenRetValMock("""{ |
|
|
"error_description": "DESC", |
|
|
|
|
|
|
|
|
"error_description": "ERROR DESCRIPTION", |
|
|
"error": "ERROR" |
|
|
"error": "ERROR" |
|
|
}""", throw=True) |
|
|
}""", throw=True) |
|
|
with mock.patch( |
|
|
with mock.patch( |
|
|
_provider_class + '._paypal_urlopen', |
|
|
_provider_class + '._paypal_urlopen', |
|
|
return_value=mocked_response, |
|
|
return_value=mocked_response, |
|
|
), self.mock_token(): |
|
|
|
|
|
|
|
|
): |
|
|
with self.assertRaises(UserError): |
|
|
with self.assertRaises(UserError): |
|
|
provider._obtain_statement_data( |
|
|
|
|
|
self.now - relativedelta(years=5), |
|
|
|
|
|
self.now, |
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
provider._paypal_retrieve('https://url', '') |
|
|
|
|
|
|
|
|
def test_empty_pull(self): |
|
|
def test_empty_pull(self): |
|
|
journal = self.AccountJournal.create({ |
|
|
journal = self.AccountJournal.create({ |
|
|