Exemplo n.º 1
0
    def test1(self):
        content = self.get_data('bar-bdbd.ru.xml')
        res = BarCi.result(content)

        true_res = {
            'domain': 'www.bdbd.ru',
            'title': '\xd2\xe5\xec\xe0: \xcf\xf0\xee\xe4\xe2\xe8\xe6\xe5\xed\xe8\xe5 \xf1\xe0\xe9\xf2\xee\xe2',
            'url': 'http://yaca.yandex.ru/yca/',
            'rang': '5',
            'value': 1600,
            'textinfo': '\xd2\xe5\xec\xe0: \xcf\xf0\xee\xe4\xe2\xe8\xe6\xe5\xed\xe8\xe5 \xf1\xe0\xe9\xf2\xee\xe2\n\xd0\xe5\xe3\xe8\xee\xed: \xd0\xee\xf1\xf1\xe8\xff\n\xc8\xf1\xf2\xee\xf7\xed\xe8\xea: \xce\xf4\xe8\xf6\xe8\xe0\xeb\xfc\xed\xfb\xe9\n\xd1\xe5\xea\xf2\xee\xf0: \xca\xee\xec\xec\xe5\xf0\xf7\xe5\xf1\xea\xe8\xe5'
        }
        self.assertDictEqual(res, true_res)
Exemplo n.º 2
0
 def get_bar(cls, site):
     from yandex_ci_parser.bar import BarCi
     url = BarCi.get_url(site)
     res = requests.get(url)
     res.raise_for_status()
     return BarCi.result(res.text)
Exemplo n.º 3
0
 def test5(self):
     res = BarCi.get_url('titapet.ru')
     self.assertEqual(res, 'http://bar-navig.yandex.ru/u?show=31&url=http://titapet.ru/')
Exemplo n.º 4
0
    def test3(self):
        content = self.get_data('bar-titapet.ru.xml')
        res = BarCi.result(content)

        true_res = {'domain': 'titapet.ru', 'title': '', 'url': '', 'rang': '0', 'value': 0, 'textinfo': ''}
        self.assertDictEqual(res, true_res)