Пример #1
0
    def test_get_rates(self):
        data = o2('Mexico')
        rates = data._get_rates('Mexico', 'monthly')

        nt.eq_(rates['landline'], u'£1.20')

        data.close()
Пример #2
0
    def test_init(self):
        data = o2('Canada', 'Germany', 'Iceland', 'Pakistan', 'Singapore', 'South Africa')
        nt.eq_(data.country_list[0], 'Canada')
        nt.eq_(data.country_list[-1], 'South Africa')
        nt.eq_(len(data.country_list), 6)

        data.close()
Пример #3
0
    def test_get_country_page(self):
        data = o2('Mexico')
        data._process_country_data()
        pq = data._get_country_page('Mexico')

        nt.ok_(pq.html > 100)

        data.close()
Пример #4
0
    def test_process_country_data(self):
        data = o2('Mexico')

        data._process_country_data()

        nt.ok_('Mexico' in data.country_data)
        nt.ok_(isinstance(data.country_data['Mexico'], dict))

        data.close()
Пример #5
0
    def test_get(self):
        data = o2('Canada', 'Germany', 'Iceland', 'Pakistan')
        data.get('monthly')

        nt.eq_(data.tariffs['Canada']['landline'], u'60p')
        nt.eq_(data.tariffs['Germany']['landline'], u'60p')
        nt.eq_(data.tariffs['Iceland']['landline'], u'80p')
        nt.eq_(data.tariffs['Pakistan']['landline'], u'£1.20')

        data.close()
Пример #6
0
    def test_get_paygo(self):
        data = o2('Canada', 'Germany', 'Iceland', 'Pakistan')
        data.get('paygo')

        nt.eq_(data.tariffs['Canada']['landline'], u'£1.50')
Пример #7
0
 def test_get_country_page_ValueError(self):
     with nt.assert_raises(ValueError):
         data = o2('Mexico')
         data._get_country_page('Mexico')
Пример #8
0
 def test_init_raises(self):
     with nt.assert_raises(ValueError):
         empty = o2()
         empty.close()