fix: test: fetch title

This commit is contained in:
rachmadaniHaryono 2018-08-01 17:38:43 +08:00
parent 8180711a33
commit 496238262f

View File

@ -1,6 +1,7 @@
"""test module."""
from itertools import product
from unittest import mock
from urllib.parse import urlparse
import json
import os
import signal
@ -554,14 +555,18 @@ def test_sigint_handler(capsys):
['about:new_page', (('', 0, 1))],
['chrome://version/', (('', 0, 1))],
['chrome://version/', (('', 0, 1))],
['http://4pda.ru/forum/index.php?showtopic=182463&st=1640#entry6044923', None],
[
'http://4pda.ru/forum/index.php?showtopic=182463&st=1640#entry6044923',
('Samsung GT-I5800 Galaxy 580 - Обсуждение - 4PDA', 0, 0)
],
[
'https://www.google.ru/search?'
'newwindow=1&safe=off&q=xkbcomp+alt+gr&'
'oq=xkbcomp+alt+gr&'
'gs_l=serp.3..33i21.28976559.28977886.0.'
'28978017.6.6.0.0.0.0.167.668.0j5.5.0....0...1c.1.64.'
'serp..1.2.311.06cSKPTLo18', None
'serp..1.2.311.06cSKPTLo18',
('xkbcomp alt gr', 0, 0)
],
]
)
@ -572,6 +577,8 @@ def test_network_handler_with_url(url, exp_res):
buku.urllib3 = urllib3
buku.myproxy = None
res = buku.network_handler(url)
if urlparse(url).netloc == 'www.google.ru':
res = (res[0].split(" - ")[0], res[1], res[2])
assert res == exp_res