def test_invalid_filter(): q = Query(filters__bazaar=Filter(), ).bind(request=req('get')) query2 = Query(filters__bazaar=Filter(), ).bind( request=req('get', **{q.get_advanced_query_param(): 'not_bazaar=asd'})) with pytest.raises(QueryException) as e: query2.get_q() assert 'Unknown filter "not_bazaar"' in str(e)
def test_invalid_value(): q = Query( filters__bazaar=Filter.integer(value_to_q=lambda filter, op, value_string_or_f: None), ).bind(request=req('get')) request = req('get', **{q.get_advanced_query_param(): 'bazaar=asd'}) query2 = Query( filters__bazaar=Filter.integer(value_to_q=lambda filter, op, value_string_or_f: None), ).bind(request=request) with pytest.raises(QueryException) as e: query2.get_q() assert 'Unknown value "asd" for filter "bazaar"' in str(e)