Fix test for blocking site from results

Previously the logic for testing site blocking was essentially "assert
blocked_site not part of result_site". This caused test failures, since
site blocking does not extend to subdomains for the blocked site. The
reversed logic makes more sense with what the test was trying to
accomplish.
main
Ben Busby 2021-12-19 11:22:47 -07:00
parent 84b5987ac5
commit 119437a07c
No known key found for this signature in database
GPG Key ID: B9B7231E01D924A1
1 changed files with 5 additions and 2 deletions

View File

@ -75,7 +75,7 @@ def test_block_results(client):
assert has_pinterest assert has_pinterest
demo_config['block'] = 'pinterest.com,help.pinterest.com' demo_config['block'] = 'pinterest.com'
rv = client.post(f'/{Endpoint.config}', data=demo_config) rv = client.post(f'/{Endpoint.config}', data=demo_config)
assert rv._status_code == 302 assert rv._status_code == 302
@ -83,7 +83,10 @@ def test_block_results(client):
assert rv._status_code == 200 assert rv._status_code == 200
for link in BeautifulSoup(rv.data, 'html.parser').find_all('a', href=True): for link in BeautifulSoup(rv.data, 'html.parser').find_all('a', href=True):
assert 'pinterest.com' not in urlparse(link['href']).netloc result_site = urlparse(link['href']).netloc
if not result_site:
continue
assert result_site not in 'pinterest.com'
def test_recent_results(client): def test_recent_results(client):