From 2e65cfad42423d1baccd74f32ebdafd0c671f08c Mon Sep 17 00:00:00 2001 From: Florent Date: Thu, 25 Jul 2013 12:22:55 +0200 Subject: [PATCH] Add real tests on leclercmobile --- modules/leclercmobile/test.py | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/modules/leclercmobile/test.py b/modules/leclercmobile/test.py index 25cbb246..ad8a1cac 100644 --- a/modules/leclercmobile/test.py +++ b/modules/leclercmobile/test.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# Copyright(C) 2012 Fourcot Florent +# Copyright(C) 2012-2013 Fourcot Florent # # This file is part of weboob. # @@ -27,8 +27,35 @@ __all__ = ['LeclercMobileTest'] class LeclercMobileTest(BackendTest): BACKEND = 'leclercmobile' - def test_leclercmobile(self): + def test_list(self): + """ + Test listing of subscriptions . + No support of multi-account on the website, we could assume to + have only one subscription. + Check the balance if the subscription is ok. + """ + subscriptions = list(self.backend.iter_subscription()) + self.assertTrue(len(subscriptions) == 1, msg="Account listing failed") + self.assertTrue(self.backend.get_balance(subscriptions[0]) > 0, + msg="Get balance failed") + + def test_downloadbills(self): + """ + Iter all bills and try to download it. + """ 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) + + def test_history(self): + for subscription in self.backend.iter_subscription(): + self.assertTrue(len(list(self.backend.iter_bills_history(subscription))) > 0) + + def test_details(self): + for subscription in self.backend.iter_subscription(): + details = list(self.backend.get_details(subscription)) + self.assertTrue(len(details) > 5, msg="Not enough details") + total = 0 + for d in details: + total += d.price + self.assertTrue(total > 0, msg="Parsing of price failed")