mirror of
https://github.com/benbusby/whoogle-search
synced 2024-11-14 18:12:45 +00:00
21012f5265
Basic autocomplete/search suggestion functionality added * Adds new GET and POST routes for '/autocomplete' that accept a string query and returns an array of suggestions * Adds new autoscript.js file for handling queries on the main page and results view * Updated requests class to include autocomplete method * Updated opensearch template to handle search suggestions * Added header template to allow for autocomplete on results view * Updated readme to mention autocomplete feature
13 lines
410 B
Python
13 lines
410 B
Python
def test_autocomplete_get(client):
|
|
rv = client.get('/autocomplete?q=green+eggs+and')
|
|
assert rv._status_code == 200
|
|
assert len(rv.data) >= 1
|
|
assert b'green eggs and ham' in rv.data
|
|
|
|
|
|
def test_autocomplete_post(client):
|
|
rv = client.post('/autocomplete', data=dict(q='the+cat+in+the'))
|
|
assert rv._status_code == 200
|
|
assert len(rv.data) >= 1
|
|
assert b'the cat in the hat' in rv.data
|