def test_successful_update(config_stub, basedir, download_stub, data_tmpdir, tmpdir, win_registry, caplog):
 config_stub.data = {'content': {'host-block-lists': generic_blocklists(tmpdir), 'host-blocking-enabled': True, 'host-blocking-whitelist': None}}
 host_blocker = adblock.HostBlocker()
 host_blocker.adblock_update()
 while host_blocker._in_progress:
  current_download = host_blocker._in_progress[0]
  with caplog.at_level(logging.ERROR):
   current_download.finished.emit()
 host_blocker.read_hosts()
 assert_urls(host_blocker, whitelisted=[])

def test_successful_update ( config_stub , basedir , download_stub , data_tmpdir , tmpdir , win_registry , caplog ) : config_stub . data = { 'content' : { 'host-block-lists' : generic_blocklists ( tmpdir ) , 'host-blocking-enabled' : True , 'host-blocking-whitelist' : None } } host_blocker = adblock . HostBlocker ( ) host_blocker . adblock_update ( ) while host_blocker . _in_progress : current_download = host_blocker . _in_progress [ 0 ] with caplog . at_level ( logging . ERROR ) : current_download . finished . emit ( ) host_blocker . read_hosts ( ) assert_urls ( host_blocker , whitelisted = [ ] )
ensure hosts from host-block-lists are blocked after an update .