def test_private_browsing(qtbot, tmpdir, fake_save_manager, config_stub):
 config_stub.data = {'general': {'private-browsing': True}}
 private_hist = history.WebHistory(hist_dir=str(tmpdir), hist_name='history')
 with qtbot.assertNotEmitted(private_hist.add_completion_item):
  with qtbot.assertNotEmitted(private_hist.item_added):
   private_hist.add_url(QUrl('http://www.example.com/'))
 assert (not private_hist._temp_history)
 with qtbot.assertNotEmitted(private_hist.add_completion_item):
  with qtbot.assertNotEmitted(private_hist.item_added):
   with qtbot.waitSignals([private_hist.async_read_done], order='strict'):
    list(private_hist.async_read())
 with qtbot.assertNotEmitted(private_hist.add_completion_item):
  with qtbot.assertNotEmitted(private_hist.item_added):
   private_hist.add_url(QUrl('http://www.example.com/'))
 assert (not private_hist._temp_history)
 assert (not private_hist._new_history)
 assert (not private_hist.history_dict)

def test_private_browsing ( qtbot , tmpdir , fake_save_manager , config_stub ) : config_stub . data = { 'general' : { 'private-browsing' : True } } private_hist = history . WebHistory ( hist_dir = str ( tmpdir ) , hist_name = 'history' ) with qtbot . assertNotEmitted ( private_hist . add_completion_item ) : with qtbot . assertNotEmitted ( private_hist . item_added ) : private_hist . add_url ( QUrl ( 'http://www.example.com/' ) ) assert ( not private_hist . _temp_history ) with qtbot . assertNotEmitted ( private_hist . add_completion_item ) : with qtbot . assertNotEmitted ( private_hist . item_added ) : with qtbot . waitSignals ( [ private_hist . async_read_done ] , order = 'strict' ) : list ( private_hist . async_read ( ) ) with qtbot . assertNotEmitted ( private_hist . add_completion_item ) : with qtbot . assertNotEmitted ( private_hist . item_added ) : private_hist . add_url ( QUrl ( 'http://www.example.com/' ) ) assert ( not private_hist . _temp_history ) assert ( not private_hist . _new_history ) assert ( not private_hist . history_dict )
make sure no data is saved at all with private browsing .