def test_config_change(config_stub, basedir, download_stub, data_tmpdir, tmpdir):
 filtered_blocked_hosts = BLOCKLIST_HOSTS[1:]
 blocklist = QUrl(create_blocklist(tmpdir, blocked_hosts=filtered_blocked_hosts, name='blocked-hosts', line_format='one_per_line'))
 config_stub.data = {'content': {'host-block-lists': [blocklist], 'host-blocking-enabled': True, 'host-blocking-whitelist': None}}
 host_blocker = adblock.HostBlocker()
 host_blocker.read_hosts()
 config_stub.set('content', 'host-block-lists', None)
 host_blocker.read_hosts()
 for str_url in URLS_TO_CHECK:
  assert (not host_blocker.is_blocked(QUrl(str_url)))

def test_config_change ( config_stub , basedir , download_stub , data_tmpdir , tmpdir ) : filtered_blocked_hosts = BLOCKLIST_HOSTS [ 1 : ] blocklist = QUrl ( create_blocklist ( tmpdir , blocked_hosts = filtered_blocked_hosts , name = 'blocked-hosts' , line_format = 'one_per_line' ) ) config_stub . data = { 'content' : { 'host-block-lists' : [ blocklist ] , 'host-blocking-enabled' : True , 'host-blocking-whitelist' : None } } host_blocker = adblock . HostBlocker ( ) host_blocker . read_hosts ( ) config_stub . set ( 'content' , 'host-block-lists' , None ) host_blocker . read_hosts ( ) for str_url in URLS_TO_CHECK : assert ( not host_blocker . is_blocked ( QUrl ( str_url ) ) )
ensure blocked-hosts resets if host-block-list is changed to none .