# -*- coding: utf-8 -*-

# Copyright(C) 2012  Fourcot Florent
#
# This file is part of weboob.
#
# weboob is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# weboob 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 Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with weboob. If not, see <http://www.gnu.org/licenses/>.


from weboob.tools.test import BackendTest


__all__ = ['LeclercMobileTest']


class LeclercMobileTest(BackendTest):
    BACKEND = 'leclercmobile'

    def test_leclercmobile(self):
        for subscription in self.backend.iter_subscription():
            list(self.backend.iter_bills_history(subscription.id))
            for bill in self.backend.iter_bills(subscription.id):
                self.backend.download_bill(bill.id)

@@ -37,16 +37,21 @@
 (C) 2012
+-2013
   Fourco
@@ -897,56 +897,272 @@
 st_l
-eclercmobile(self):%0A        for subscription in 
+ist(self):%0A        %22%22%22%0A        Test listing of subscriptions .%0A        No support of multi-account on the website, we could assume to%0A        have only one subscription.%0A        Check the balance if the subscription is ok.%0A        %22%22%22%0A        subscriptions = list(
 self
@@ -1189,17 +1189,17 @@
 iption()
-:
+)
 %0A       
@@ -1203,181 +1203,1049 @@
     
-    list(self.backend.iter_bills_history(subscription.id))%0A            for bill in self.backend.iter_bills(subscription.id):%0A                self.backend.download_bill(bill.id
+self.assertTrue(len(subscriptions) == 1, msg=%22Account listing failed%22)%0A        self.assertTrue(self.backend.get_balance(subscriptions%5B0%5D) %3E 0,%0A                        msg=%22Get balance failed%22)%0A%0A    def test_downloadbills(self):%0A        %22%22%22%0A        Iter all bills and try to download it.%0A        %22%22%22%0A        for subscription in self.backend.iter_subscription():%0A            for bill in self.backend.iter_bills(subscription.id):%0A                self.backend.download_bill(bill.id)%0A%0A    def test_history(self):%0A        for subscription in self.backend.iter_subscription():%0A            self.assertTrue(len(list(self.backend.iter_bills_history(subscription))) %3E 0)%0A%0A    def test_details(self):%0A        for subscription in self.backend.iter_subscription():%0A            details = list(self.backend.get_details(subscription))%0A            self.assertTrue(len(details) %3E 5, msg=%22Not enough details%22)%0A            total = 0%0A            for d in details:%0A                total += d.price%0A            self.assertTrue(total %3E 0, msg=%22Parsing of price failed%22
 )%0A

Add real tests on leclercmobile