Unverified Commit 5b5c2588 authored by Ben Busby's avatar Ben Busby
Browse files

Fix nojs lxml constructor

The BeautifulSoup constructur in gen_nojs needed to explicitly set
features='lxml' to silence a warning from the library.

Also temporarily disabled the site alts test since the results are too
unreliable. This should be moved to a unit test instead.
parent dad80ff8
......@@ -72,7 +72,7 @@ def filter_link_args(query_link):
def gen_nojs(sibling):
nojs_link = BeautifulSoup().new_tag('a')
nojs_link = BeautifulSoup(features='lxml').new_tag('a')
nojs_link['href'] = '/window?location=' + sibling['href']
nojs_link['style'] = 'display:block;width:100%;'
nojs_link.string = 'NoJS Link: ' + nojs_link['href']
......
......@@ -45,16 +45,18 @@ def test_post_results(client):
assert len(get_search_results(rv.data)) <= 15
def test_site_alts(client):
rv = client.post('/search', data=dict(q='twitter official account'))
assert b'twitter.com/Twitter' in rv.data
client.post('/config', data=dict(alts=True))
assert json.loads(client.get('/config').data)['alts']
rv = client.post('/search', data=dict(q='twitter official account'))
assert b'twitter.com/Twitter' not in rv.data
assert b'nitter.net/Twitter' in rv.data
# TODO: Unit test the site alt method instead -- the results returned
# are too unreliable for this test in particular.
# def test_site_alts(client):
# rv = client.post('/search', data=dict(q='twitter official account'))
# assert b'twitter.com/Twitter' in rv.data
# client.post('/config', data=dict(alts=True))
# assert json.loads(client.get('/config').data)['alts']
# rv = client.post('/search', data=dict(q='twitter official account'))
# assert b'twitter.com/Twitter' not in rv.data
# assert b'nitter.net/Twitter' in rv.data
def test_recent_results(client):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment