whoogle-search/test/test_autocomplete.py
Ben Busby 1d0c63c217 Basic autocomplete functionality added
Still need to add support to the opensearch xml template, but otherwise
the main page functionality is working as expected

Adds new route '/autocomplete' that accepts a string query for both GET and POST requests, and returns an array of suggestions

Adds GET and POST tests for autocomplete search as well
2020-05-23 15:38:37 -06:00

21 lines
572 B
Python

from bs4 import BeautifulSoup
from cryptography.fernet import Fernet
from app.filter import Filter
from datetime import datetime
from dateutil.parser import *
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