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_boolean_false(): url = "/v1/company_query_builder?ecommerce=false" response = get_es_query(url) assert response == full_es_query(None)
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_top_end(): url = "/v1/company_query_builder?revenue=-100" response = get_es_query(url) assert response == revenue_range_template(None, 100)
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_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_one_value(): url = "/v1/company_query_builder?cid=1" response = get_es_query(url) assert response == full_es_query({'terms': {'cid': ['1']}})
def test_multiple_values(): url = "/v1/company_query_builder?cid=1&cid=2&cid=100" response = get_es_query(url) assert response == full_es_query({'terms': {'cid': ['1', '2', '100']}})