fixes on fortuneo module

backend.py
    iter_history() implemented
  browser.py
    '.*/prive/default\.jsp.*' page added to AccountsList to prevent warnings
    full url on self.location() using 'https://' + self.DOMAIN_LOGIN + 'stuff'
  pages/accounts_list.py
    added unicode() to prevent warnings
  test.py
    test really implemented after site maintenance
This commit is contained in:
sputnick 2012-04-22 18:48:25 +02:00
commit 507c9d2c80
4 changed files with 13 additions and 13 deletions

View file

@ -73,10 +73,6 @@ class FortuneoBackend(BaseBackend, ICapBank):
else:
raise AccountNotFound()
def iter_coming(self, account):
"""Iter coming transactions on a specific account Not supported yet"""
raise NotImplementedError()
def iter_history(self, account):
"""Iter history of transactions on a specific account"""

View file

@ -19,7 +19,7 @@
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
from weboob.tools.browser import BaseBrowser #, BrowserIncorrectPassword
from weboob.tools.browser import BaseBrowser
from .pages.login import LoginPage
from .pages.accounts_list import AccountsList, AccountHistoryPage
@ -37,7 +37,9 @@ class Fortuneo(BaseBrowser):
'.*/prive/mes-comptes/synthese-tous-comptes\.jsp.*':
AccountsList,
'.*/prive/mes-comptes/livret/consulter-situation/consulter-solde\.jsp\?COMPTE_ACTIF=.*':
AccountHistoryPage
AccountHistoryPage,
'.*/prive/default\.jsp.*':
AccountsList
}
def __init__(self, *args, **kwargs):
@ -45,7 +47,8 @@ class Fortuneo(BaseBrowser):
def home(self):
"""main page (login)"""
self.location('/fr/prive/identification.jsp')
self.location('https://' + self.DOMAIN_LOGIN + '/fr/prive/identification.jsp')
def is_logged(self):
"""Return True if we are logged on website"""
@ -67,7 +70,7 @@ class Fortuneo(BaseBrowser):
self.location('https://' + self.DOMAIN_LOGIN + '/fr/identification.jsp')
self.page.login(self.username, self.password)
self.location('/fr/prive/mes-comptes/synthese-tous-comptes.jsp')
self.location('https://' + self.DOMAIN_LOGIN + '/fr/prive/mes-comptes/synthese-tous-comptes.jsp')
def get_history(self, account):
if not self.is_on_page(AccountHistoryPage):
@ -78,12 +81,13 @@ class Fortuneo(BaseBrowser):
"""accounts list"""
if not self.is_on_page(AccountsList):
self.location('/fr/prive/mes-comptes/synthese-tous-comptes.jsp')
self.location('https://' + self.DOMAIN_LOGIN + '/fr/prive/mes-comptes/synthese-tous-comptes.jsp')
return self.page.get_list()
def get_account(self, id):
"""Get an account from its ID"""
assert isinstance(id, basestring)
l = self.get_accounts_list()

View file

@ -29,7 +29,6 @@ from weboob.capabilities import NotAvailable
__all__ = ['AccountsList', 'AccountHistoryPage']
class AccountHistoryPage(BasePage):
def get_operations(self, _id):
"""history, see http://docs.weboob.org/api/capabilities/bank.html?highlight=transaction#weboob.capabilities.bank.Transaction"""
@ -47,7 +46,7 @@ class AccountHistoryPage(BasePage):
date_oper = tables[i].xpath("./td[2]/text()")[0]
date_val = tables[i].xpath("./td[3]/text()")[0]
label = tables[i].xpath("./td[4]/text()")[0]
operation.label = operation.raw = label.strip()
operation.label = unicode(label.strip())
amount = tables[i].xpath("./td[5]/text() | ./td[6]/text()")
operation.date = datetime.datetime.strptime(date_val, "%d/%m/%Y")
operation.rdate = datetime.datetime.strptime(date_oper,"%d/%m/%Y")
@ -95,7 +94,7 @@ class AccountsList(BasePage):
# account.label
tpl = cpt.xpath("./td[2]/a/text()")[0].split(' ')
account.label = ' '.join(tpl[:2])
account.label = unicode(' '.join(tpl[:2]))
l.append(account)

View file

@ -27,5 +27,6 @@ class FortuneoTest(BackendTest):
l = list(self.backend.iter_accounts())
self.assertTrue(len(l) > 0)
a = l[0]
list(self.backend.iter_coming(a))
list(self.backend.iter_history(a))
# vim:ts=4:sw=4