Commit e1f70792 authored by Simon Bordeyne's avatar Simon Bordeyne Committed by Vincent A

[free] Fix unicode errors and raise WebsiteUnavailable in login

- unicode_litterals import added to modules/free/browser.py and modules/free/module.py
- removed unused unit test
- raise WebsiteUnavailable if there are too many requests instead of raising an AssertionError

Closes: 50138@sibi
parent 7661dd80
......@@ -17,9 +17,10 @@
# You should have received a copy of the GNU Lesser General Public License
# along with this weboob module. If not, see <http://www.gnu.org/licenses/>.
from __future__ import unicode_literals
from weboob.browser import LoginBrowser, URL, need_login
from weboob.exceptions import BrowserIncorrectPassword
from weboob.exceptions import BrowserIncorrectPassword, BrowserUnavailable
from .pages import LoginPage, HomePage, ConsolePage, SuiviPage, DocumentsPage, ProfilePage
......@@ -53,6 +54,8 @@ class FreeBrowser(LoginBrowser):
error = self.page.get_error()
if error and 'mot de passe' in error:
raise BrowserIncorrectPassword(error)
if error and 'reeconnecter' in error:
raise BrowserUnavailable(error)
raise AssertionError('Unhandled behavior at login: error is "{}"'.format(error))
elif self.documents.is_here():
......
......@@ -17,6 +17,7 @@
# You should have received a copy of the GNU Lesser General Public License
# along with this weboob module. If not, see <http://www.gnu.org/licenses/>.
from __future__ import unicode_literals
from weboob.capabilities.bill import DocumentTypes, CapDocument, Subscription, Document, SubscriptionNotFound, DocumentNotFound
from weboob.capabilities.profile import CapProfile
......
# -*- coding: utf-8 -*-
# Copyright(C) 2012-2020 Budget Insight
#
# This file is part of a weboob module.
#
# This weboob module is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This weboob module is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this weboob module. If not, see <http://www.gnu.org/licenses/>.
from weboob.tools.test import BackendTest
class FreeTest(BackendTest):
MODULE = 'free'
def test_free(self):
raise NotImplementedError()
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