def test_boolean_true(): url = "/v1/company_query_builder?ecommerce=true" response = get_es_query(url) assert response == full_es_query( {'term': { 'ecommerce.is_ecommerce': True }})
def test_range_top_end(): url = "/v1/company_query_builder?revenue=-100" response = get_es_query(url) assert response == revenue_range_template(None, 100)
def test_range_bottom_end(): url = "/v1/company_query_builder?revenue=1-" response = get_es_query(url) assert response == revenue_range_template(1, None)
def test_range_both_ends(): url = "/v1/company_query_builder?revenue=1-100" response = get_es_query(url) assert response == revenue_range_template(1, 100)
def test_all(url): get_es_query(url)
def test_lte_lessThan_gte(): url = "/v1/company_query_builder?revenue=-1--100" with pytest.raises(Exception): response = get_es_query(url)
def test_negative_lte_gte(): url = "/v1/company_query_builder?revenue=-100--1" response = get_es_query(url) assert response == revenue_range_template(-100, -1)
def test_date_range_upper_end(): url = "/v1/company_query_builder?trading_activity=-20160101" response = get_es_query(url) assert response == trade_activity_template(None, "2016-01-01")
def test_date_range_bottom_end(): url = "/v1/company_query_builder?trading_activity=20150101-" response = get_es_query(url) assert response == trade_activity_template("2015-01-01", None)
def test_boolean_false(): url = "/v1/company_query_builder?ecommerce=false" response = get_es_query(url) assert response == full_es_query(None)