diff --git a/modules/groupamaes/backend.py b/modules/groupamaes/backend.py index 9eac8e63..5f811a8c 100644 --- a/modules/groupamaes/backend.py +++ b/modules/groupamaes/backend.py @@ -20,7 +20,7 @@ from weboob.capabilities.bank import ICapBank, AccountNotFound from weboob.tools.backend import BaseBackend, BackendConfig from weboob.tools.value import ValueBackendPassword - +from weboob.capabilities.base import find_object from .browser import GroupamaesBrowser @@ -54,8 +54,4 @@ class GroupamaesBackend(BaseBackend, ICapBank): return self.browser.get_history() def get_account(self, _id): - account = self.browser.get_account(_id) - if account: - return account - else: - raise AccountNotFound() + return find_object(self.browser.get_accounts_list(), id=_id, error=AccountNotFound) diff --git a/modules/groupamaes/browser.py b/modules/groupamaes/browser.py index 4ec1dd50..ddfc2039 100644 --- a/modules/groupamaes/browser.py +++ b/modules/groupamaes/browser.py @@ -59,9 +59,3 @@ class GroupamaesBrowser(LoginBrowser): transactions = list(self.operations_futures.go().get_list()) transactions.sort(key=lambda tr: tr.rdate, reverse=True) return transactions - - def get_account(self, id): - assert isinstance(id, basestring) - for a in self.get_accounts_list(): - if a.id == id: - return a diff --git a/modules/groupamaes/test.py b/modules/groupamaes/test.py index a7bfd352..10310d4b 100644 --- a/modules/groupamaes/test.py +++ b/modules/groupamaes/test.py @@ -28,4 +28,5 @@ class GroupamaesTest(BackendTest): l = list(self.backend.iter_accounts()) if len(l) > 0: a = l[0] + self.assertTrue(self.backend.get_account(l[0].id) is not None) list(self.backend.iter_history(a))