test.py 1.41 KB
Newer Older
1 2
# -*- coding: utf-8 -*-

Romain Bignon's avatar
Romain Bignon committed
3
# Copyright(C) 2011  Romain Bignon
4
#
5
# This file is part of a weboob module.
6
#
7
# This weboob module is free software: you can redistribute it and/or modify
8 9 10 11
# 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.
#
12
# This weboob module is distributed in the hope that it will be useful,
13
# but WITHOUT ANY WARRANTY; without even the implied warranty of
14 15
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
16
#
17
# You should have received a copy of the GNU Affero General Public License
18
# along with this weboob module. If not, see <http://www.gnu.org/licenses/>.
19 20 21 22


from weboob.tools.test import BackendTest

23

Romain Bignon's avatar
Romain Bignon committed
24
class YahooTest(BackendTest):
Florent Fourcot's avatar
Florent Fourcot committed
25
    MODULE = 'yahoo'
26

Romain Bignon's avatar
Romain Bignon committed
27 28 29 30 31 32
    def test_meteo(self):
        l = list(self.backend.iter_city_search('paris'))
        self.assertTrue(len(l) > 0)

        city = l[0]
        current = self.backend.get_current(city.id)
33 34 35 36 37 38 39

        self.assertTrue(current.temp.unit in ['C', 'F'])

        if current.temp.unit == 'F':
            self.assertTrue(current.temp.value > -4 and current.temp.value < 122)
        else:
            self.assertTrue(current.temp.value > -20 and current.temp.value < 50)
Romain Bignon's avatar
Romain Bignon committed
40 41 42

        forecasts = list(self.backend.iter_forecast(city.id))
        self.assertTrue(len(forecasts) > 0)