Commit be663cbb authored by Guillaume Risbourg's avatar Guillaume Risbourg Committed by Vincent A

[caissedepargne] Fixed get_measure_accounts_list + add ownership for old website

parent 6a80691b
......@@ -395,6 +395,8 @@ class CaisseEpargne(LoginBrowser, StatesMixin):
def get_measure_accounts_list(self):
self.home.go()
owner_name = self.get_profile().name.upper().split(' ', 1)[1]
# Make sure we are on list of measures page
if self.measure_page.is_here():
self.page.check_no_accounts()
......@@ -403,7 +405,7 @@ class CaisseEpargne(LoginBrowser, StatesMixin):
for measure_id in measure_ids:
self.page.go_measure_accounts_list(measure_id)
if self.page.check_measure_accounts():
for account in list(self.page.get_list()):
for account in list(self.page.get_list(owner_name)):
account._info['measure_id'] = measure_id
self.accounts.append(account)
self.page.go_measure_list()
......
......@@ -384,6 +384,7 @@ class IndexPage(LoggedPage, HTMLPage):
else:
# On the same row, there could have many accounts (check account and a card one).
# For the card line, the number will be the same than the checking account, so we skip it.
ownership = self.get_ownership(tds, owner_name)
if len(tds) > 4:
for i, a in enumerate(tds[2].xpath('./a')):
label = CleanText('.')(a)
......@@ -393,13 +394,13 @@ class IndexPage(LoggedPage, HTMLPage):
# checking parent account, we have to skip it.
if i == 0:
number = CleanText('.')(tds[-4].xpath('./a')[0])
self._add_account(accounts, a, label, account_type, balance, number)
self._add_account(accounts, a, label, account_type, balance, number, ownership=ownership)
# Only 4 tds on "banque de la reunion" website.
elif len(tds) == 4:
for i, a in enumerate(tds[1].xpath('./a')):
label = CleanText('.')(a)
balance = CleanText('.')(tds[-1].xpath('./a')[i])
self._add_account(accounts, a, label, account_type, balance)
self._add_account(accounts, a, label, account_type, balance, ownership=ownership)
self.logger.warning('we are on the %s website', 'old' if accounts else 'new')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment