def test_add_item_redirect_update(qtbot, tmpdir):
 url = 'http://www.example.com/'
 hist_file = (tmpdir / 'filled-history')
 hist_file.write('12345 {}\n'.format(url))
 hist = history.WebHistory(hist_dir=str(tmpdir), hist_name='filled-history')
 list(hist.async_read())
 with qtbot.assertNotEmitted(hist.add_completion_item):
  with qtbot.waitSignal(hist.item_added):
   hist.add_url(QUrl(url), redirect=True, atime=67890)
 entry = history.Entry(url=QUrl(url), redirect=True, atime=67890, title='')
 assert (hist.history_dict[url] == entry)

def test_add_item_redirect_update ( qtbot , tmpdir ) : url = 'http://www.example.com/' hist_file = ( tmpdir / 'filled-history' ) hist_file . write ( '12345 {}\n' . format ( url ) ) hist = history . WebHistory ( hist_dir = str ( tmpdir ) , hist_name = 'filled-history' ) list ( hist . async_read ( ) ) with qtbot . assertNotEmitted ( hist . add_completion_item ) : with qtbot . waitSignal ( hist . item_added ) : hist . add_url ( QUrl ( url ) , redirect = True , atime = 67890 ) entry = history . Entry ( url = QUrl ( url ) , redirect = True , atime = 67890 , title = '' ) assert ( hist . history_dict [ url ] == entry )
a redirect update added should override a non-redirect one .