From 119437a07cff549305baa73abbe7518d0c20f5b1 Mon Sep 17 00:00:00 2001 From: Ben Busby Date: Sun, 19 Dec 2021 11:22:47 -0700 Subject: [PATCH] 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. --- test/test_results.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/test/test_results.py b/test/test_results.py index 8327973..f8036d8 100644 --- a/test/test_results.py +++ b/test/test_results.py @@ -75,7 +75,7 @@ def test_block_results(client): 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) assert rv._status_code == 302 @@ -83,7 +83,10 @@ def test_block_results(client): assert rv._status_code == 200 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):