From 7288a3802ea23eb2afee08b00f52401cb2b4795f Mon Sep 17 00:00:00 2001 From: Vincent Ardisson Date: Mon, 12 Dec 2016 16:01:32 +0100 Subject: [PATCH] [bforbank] fix case with multiple bourse accounts Another page of the site doesn't clear cookies and avoids a redirection. --- modules/bforbank/browser.py | 10 +++++----- modules/bforbank/pages.py | 5 ----- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/modules/bforbank/browser.py b/modules/bforbank/browser.py index 143b564b6a..bbe5e98449 100644 --- a/modules/bforbank/browser.py +++ b/modules/bforbank/browser.py @@ -25,7 +25,7 @@ from .pages import ( LoginPage, ErrorPage, AccountsPage, HistoryPage, LoanHistoryPage, RibPage, LifeInsuranceList, LifeInsuranceIframe, LifeInsuranceRedir, - TitrePage, BoursePage, + BoursePage, ) from .spirica_browser import SpiricaBrowser @@ -45,7 +45,7 @@ class BforbankBrowser(LoginBrowser): lifeinsurance_iframe = URL(r'/client/accounts/lifeInsurance/consultationDetailSpirica.action', LifeInsuranceIframe) lifeinsurance_redir = URL(r'https://assurance-vie.bforbank.com:443/sylvea/welcomeSSO.xhtml', LifeInsuranceRedir) - titre = URL(r'/client/accounts/stocks/consultation/noFramePartenaireCATitres.action\?id=0', TitrePage) + bourse_login = URL(r'/espace-client/synthese/debranchementCaTitre/(?P\d+)') bourse = URL('https://bourse.bforbank.com/netfinca-titres/servlet/com.netfinca.frontcr.synthesis.HomeSynthesis', 'https://bourse.bforbank.com/netfinca-titres/servlet/com.netfinca.frontcr.account.*', BoursePage) @@ -122,9 +122,7 @@ def goto_spirica(self, account): self.spirica.logged = True def get_bourse_account(self, account): - self.titre.go() - assert self.titre.is_here() - self.location(self.page.get_redir()) # "login" to bourse page + self.bourse_login.go(id=account.id) # "login" to bourse page self.bourse.go() assert self.bourse.is_here() @@ -134,6 +132,8 @@ def get_bourse_account(self, account): self.logger.debug('iterating account %r', bourse_account) if bourse_account.id.startswith(account.id[3:]): return bourse_account + else: + raise AccountNotFound() @need_login def iter_investment(self, account): diff --git a/modules/bforbank/pages.py b/modules/bforbank/pages.py index 5a8195db71..96ea938cbe 100644 --- a/modules/bforbank/pages.py +++ b/modules/bforbank/pages.py @@ -219,11 +219,6 @@ def get_redir(self): return match.group(1) -class TitrePage(LoggedPage, HTMLPage): - def get_redir(self): - return Regexp(CleanText('//body/@onload'), r"document.location='(.*)'", r'\1')(self.doc) - - class BoursePage(AbstractPage): PARENT = 'lcl' PARENT_URL = 'bourse' -- GitLab