From e0ebe4c1d4b1ed349e424ba7ab59954c5a4fd88e Mon Sep 17 00:00:00 2001 From: Florent Date: Thu, 8 May 2014 12:23:10 +0200 Subject: [PATCH] Better tests coverage in ING --- modules/ing/test.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/modules/ing/test.py b/modules/ing/test.py index 127be182..1ed3679d 100644 --- a/modules/ing/test.py +++ b/modules/ing/test.py @@ -20,6 +20,7 @@ from weboob.tools.test import BackendTest from weboob.capabilities.bank import Account +import random class INGTest(BackendTest): @@ -28,15 +29,28 @@ class INGTest(BackendTest): def test_accounts(self): l = list(self.backend.iter_accounts()) for account in l: + # Test if get_account works + _id = self.backend.get_account(account.id) + self.assertTrue(_id.id == account.id) + # Methods can use Account objects or id. Try one of them + id_or_account = random.choice([account, account.id]) if account.type == Account.TYPE_CHECKING or account.type == Account.TYPE_CHECKING: - history = list(self.backend.iter_history(account)) + history = list(self.backend.iter_history(id_or_account)) self.assertTrue(len(history) > 0) + recipients = list(self.backend.iter_transfer_recipients(id_or_account)) + self.assertTrue(len(recipients) > 0) elif account.type == Account.TYPE_MARKET: - invest = list(self.backend.iter_investment(account)) + invest = list(self.backend.iter_investment(id_or_account)) + self.backend.iter_history(id_or_account) # can be empty. Only try to call it self.assertTrue(len(invest) > 0) def test_subscriptions(self): l = list(self.backend.iter_subscription()) for sub in l: + _id = self.backend.get_subscription(sub.id) + self.assertTrue(_id.id == sub.id) bills = list(self.backend.iter_bills(sub)) self.assertTrue(len(bills) > 0) + _id = self.backend.get_bill(bills[0].id) + self.assertTrue(_id.id == bills[0].id) + self.backend.download_bill(bills[0].id)